I wanted to discuss a small but important aspect of how IPFS uses gateways. In practice this is more of a call to browser developers for implementing such a feature, though the question may apply to applications other than web browsing. I’m sure something like this is planned or has been done already, but I wanted to ask how the problem will be handled exactly and your general thoughts on the matter.
Here’s my concern: Excluding a few services which spawn their own IPFS node, IPFS files accessed in a web browser must go through a gateway. This can be either your local gateway, spawned when you’re running go-ipfs or have js-ipfs in a browser extension… or an external gateway, such as the official one or the one Cloudflare is now offering. Every gateway has its own URL: If you’re using the local gateway this URL will be “http://127.0.0.1:8080/ipfs/”, while if you’re going with a public gateway it will be something like “https://gateway.ipfs.io/ipfs/”. The problem is this: How can I share a link to a website hosted on IPFS without having to tell people which gateway it goes through?
Let’s imagine I have a blog hosted on an IPNS domain. I want to share it on a chat, where I wish to be sure that anyone can see it. Clearly I cannot assume that everyone has go-ipfs installed so I can’t offer the local one. Right now I’d give them a link that goes through the official IPFS gateway… however that’s going to get more crowded and thus slow, may experience downtime at certain times, and may someday be required to censor content or risk being blocked. I could of course just give them the hash, but who’s going to be happy about being asked to search for a gateway and paste it into that? Ultimately it’s my responsibility to customize the URL to contain a gateway I trust and choose between various options such as:
http://127.0.0.1:8080/ipfs/1234567890
https://gateway.ipfs.io/ipfs/1234567890
https://cloudflare-ipfs.com/ipfs/1234567890
So how can this issue be solved? I was thinking of a convenient way, but it would require all major web browsers to agree on implementing support for the IPFS backend. It would be an extremely small and simple feature so I do see it happening. Basically I could just share the following URL with other people instead:
ipfs://1234567890
The browser then simply replaces “ipfs://” with “https://whatever-service.com/ipfs/”. The advantage is that browsers can contain a list of gateways, which they can attempt to parse the content through in a given order: When one is down it simply tries another! For example: First it would try 127.0.0.1:8080, if go-ipfs isn’t running then it will detect that nothing is there… so next it tries gateway.ipfs.io, if that’s up and not filtering the content then it uses that… but if this fails too it tries cloudflare-ipfs.com next… and so on until either one succeeds or the list reaches the end. Web browsers could contain default lists of IPFS gateways, which the user is of course allowed to customize and add their own entries to.
My question is how likely we are to see support for such a feature in web browsers. Mozilla recently added IPFS protocol support to Firefox, and I understand it was for URL interpretation… however I still can’t find a gateway customization setting on the about:config page. What about Chromium, is it likely to support ipfs:// addresses and offer customizable gateways? Or Microsoft with its Internet Explorer?