IPFS, Again
&gt;Ready to publish it to the web? Not so fast. Clicking a link brings us back to my issue in 2017 [link]: the way that the IPFS gateway works will break your links.<p>(following the link to 2017 post)<p>&gt;And even if I used the base tag to re-route that link so that it points <a href="http:&#x2F;&#x2F;localhost:8080&#x2F;ipfs&#x2F;QmR96iiRBEroYAe955my8cdHkK4kAu6SApGC2eS5kSzHwt&#x2F;2017&#x2F;08&#x2F;01&#x2F;recently.html" rel="nofollow">http:&#x2F;&#x2F;localhost:8080&#x2F;ipfs&#x2F;QmR96iiRBEroYAe955my8cdHkK4kAu6SA...</a> ... It wouldn’t work: the correct URL for that Recently post is, instead, <a href="http:&#x2F;&#x2F;localhost:8080&#x2F;ipfs&#x2F;QmTbJ6RSLZDmVYy8dgdoeQLCtKya7UrNTCqaw93yZCpH5T&#x2F;" rel="nofollow">http:&#x2F;&#x2F;localhost:8080&#x2F;ipfs&#x2F;QmTbJ6RSLZDmVYy8dgdoeQLCtKya7UrNT...</a>. So IPFS content links are fully content-addressed. I suppose to make my site fully IPFS, I’d have to build each individual page and then construct a home page that linked to the generated hashes for those pages. That leaves an open question: how could two pages link to each other? Adding a link from one page to the other would change its hash, so wouldn’t it be impossible for pages to reference each other? This might be a lack-of-coffee problem on my part.<p>They&#x27;ve misunderstood that. Both links of these links would be valid. You would have all the pages be under <a href="http:&#x2F;&#x2F;localhost:8080&#x2F;ipfs&#x2F;QmR96iiRBEroYAe955my8cdHkK4kAu6SApGC2eS5kSzHwt&#x2F;" rel="nofollow">http:&#x2F;&#x2F;localhost:8080&#x2F;ipfs&#x2F;QmR96iiRBEroYAe955my8cdHkK4kAu6SA...</a> and refer to each other by relative links.<p>The author&#x27;s point of relative links or a base tag being necessary for the site to work on the ipfs gateway URLs is valid though.<p>(back to new article)<p>&gt;So, links don’t work. I posted an issue detailing this issue, and while I got an encouraging response that there’s a real solution planned, there’s no real solution. People use specific plugins just for IPFS, like this one for GatsbyJS, to get it to work. I ended up writing make-relative, a script that rewrites my built site to use relative links. This is where the story about IPFS being useful here and now for web developers breaks down a little. I’ve done enough HTML-mangling and path-resolution in my decade in industry that writing this script was straightforward. But the knowledge required to do it is not all that common, and I think this is where a majority of web developers would call it quits, because IPFS’s ‘website hosting’ story would look broken.<p>You can either use relative links, a base tag, or keep absolute links and only support your domain with dnslink (and eventually when the web gateways support the hash in the subdomain field, or extensions support the ipfs:&#x2F;&#x2F; protocol, then your site will also work through that). I&#x27;m hoping for the hash-as-subdomain support which will make things simple.<p>&gt;IPNS<p>Yeah, it&#x27;s awkward. This is because of multiple reasons (zooko&#x27;s triangle and hosting of the names) that can only be addressed with a centralized service (see DNSLink) or a blockchain. Thankfully there&#x27;s the DNSLink option too. I wish the IPFS docs wouldn&#x27;t push IPNS as much because it&#x27;s not ready &#x2F; it&#x27;s not what most people want.<p>&gt;That was an incorrect assumption. IPFS-based websites do update their DNS records every time that they update their website, so that they can avoid using IPNS, because IPNS is just too slow. This was a tough discovery, because it works against everything I know about DNS – a system that isn’t particularly designed to be fast or scriptable.<p>IPFS isn&#x27;t for frequently changing websites. You&#x27;re not going to host a forum or other dynamic site on IPFS. (Or if you do, it&#x27;s going to work by being static content hosted on IPFS that contains some javascript that talks to some regular external HTTP(S) servers or maybe even a WebRTC swarm for all of the dynamic content.)<p>&gt;Unfortunately, once I started getting this set up as a ‘pinning device’ [server], the fun stopped. I tried running ipfs pin add with the hash generated earlier from ipfs add -r, but it just ‘hung’ - outputting nothing at all. After a while I realized that, like ipfs pin add, IPFS doesn’t communicate very well when it’s having a problem. So I figured out how to turn logging information all the way up, and then… I was never able to get past a ‘got error on dial’ failure, despite trying all potential configurations of the IPFS daemon, enabling logging, upgrading to the newest version, and so on. There are about 63 similar issues in the tracker, 21 of which are marked as bugs.<p>I think the &quot;got error on dial&quot; errors are just it complaining that it can&#x27;t connect to some random people in the p2p swarm. Like people who may have recently turned off their computers, etc. You can&#x27;t expect to be able to connect to everyone in the p2p swarm. IPFS is just trying to connect to tons of people in the swarm until it finds people with the blocks that you&#x27;re trying to pin, and it&#x27;s reporting errors that it can&#x27;t connect to some of the people in the swarm. The real problem is that it should be giving some kind of logs of how it&#x27;s trying to find some content, it&#x27;s successfully connected to a bunch of people, but none of them it&#x27;s talked to yet have it. Also of course it should eventually make a connection back to your computer and successfully get those blocks. I&#x27;m not sure why that&#x27;s not happening and that&#x27;s disappointing it&#x27;s not working. I really hope IPFS improves in things like this because the concept of IPFS seems great.