Hacker News new | past | comments | ask | show | jobs | submit login

>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.

(following the link to 2017 post)

>And even if I used the base tag to re-route that link so that it points http://localhost:8080/ipfs/QmR96iiRBEroYAe955my8cdHkK4kAu6SA... ... It wouldn’t work: the correct URL for that Recently post is, instead, http://localhost:8080/ipfs/QmTbJ6RSLZDmVYy8dgdoeQLCtKya7UrNT.... 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.

They've misunderstood that. Both links of these links would be valid. You would have all the pages be under http://localhost:8080/ipfs/QmR96iiRBEroYAe955my8cdHkK4kAu6SA... and refer to each other by relative links.

The author's point of relative links or a base tag being necessary for the site to work on the ipfs gateway URLs is valid though.

(back to new article)

>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.

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:// protocol, then your site will also work through that). I'm hoping for the hash-as-subdomain support which will make things simple.


Yeah, it's awkward. This is because of multiple reasons (zooko's triangle and hosting of the names) that can only be addressed with a centralized service (see DNSLink) or a blockchain. Thankfully there's the DNSLink option too. I wish the IPFS docs wouldn't push IPNS as much because it's not ready / it's not what most people want.

>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.

IPFS isn't for frequently changing websites. You're not going to host a forum or other dynamic site on IPFS. (Or if you do, it'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.)

>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.

I think the "got error on dial" errors are just it complaining that it can't connect to some random people in the p2p swarm. Like people who may have recently turned off their computers, etc. You can'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're trying to pin, and it's reporting errors that it can'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's trying to find some content, it's successfully connected to a bunch of people, but none of them it'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'm not sure why that's not happening and that's disappointing it's not working. I really hope IPFS improves in things like this because the concept of IPFS seems great.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact