URI router for registerProtocolHandler
Down the road we will need ?uri router from subdomain specs. It is similar to ?helia-sw we already have, but accepts percent-encoded URIs as value, and can be registered via registerProtocolHandler:
navigator.registerProtocolHandler('ipfs', 'https://inbrowser.link/ipfs/?uri=%s', 'IPFS resolver')
Implementing URI router will allow us to use inbrowser.link as drop-in replacement for dweb.link in ipfs-companion and also use it in discussions with standards bodies and browser vendors on the path towards https://github.com/ipfs/in-web-browsers/issues/212 (redirect-based handler is step 1, sw-based one wis step 2. if we can show we have sw ready, and also provide a way of using it with step 1, this makes conversations more conductive).
Ref.
- https://specs.ipfs.tech/http-gateways/subdomain-gateway/#uri-router
- https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler
I believe this is a part of specs.ipfs.tech and should live in verified-fetch, yes?
This is specific to subdomain gateway, so does not benefit users who use veirfied-fetch directly, but yes, implementation-wise, it would be the easiest if it lived in verified-fetch and returned HTTP 301:
-
/ipfs/?uri=%s→/ipfs/cid/.. -
/ipns/?uri=%s→/ipns/id/..