Ipfs-webui: Inspect view: "View on IPFS Gateway" still points to the ip-address, not to .localhost

Created on 10 May 2020  ·  3Comments  ·  Source: ipfs/ipfs-webui

Describe the bug
On the inspect view there's a button labled with "View on IPFS Gateway", which still points (in my case) to 127.0.0.1/ipfs/<CID> instead of <CID>.ipfs.localhost.

Screenshots
Screenshot_20200510_162131-1

Desktop (please complete the following information):

  • OS: Linux
  • Browser: Brave
kinbug exintermediate P1 statuready efforhours

All 3 comments

@lidel and/or @rafaelramalho19 -- can you please have a look? Thank you!

I was able to replicate it 👍

Thank you for reporting this Ruben, I will check it out.

@rafaelramalho19 After additional analysis I am afraid we need to revert #1559 – it won't work in offline contexts and private swarms (without ipfs-companionloading from public gateway will hang forever and then timeout)

We also can't just blindly swap 127.0.0.1 with localhost because localhost subdomains are not guaranteed to be enabled and work everywhere (https://github.com/ipfs/go-ipfs/issues/7527)

Additional heuristic should be added in the place where gatewayUrl is read from node's config:

  • If gateway is 127.0.0.1:port

    • send GET request for <knowncid>.ipfs.localhost:port (eg. empty unixfs dir)



      • If response in HTTP 200, then subdomains work in current browser


      • replace 127.0.0.1:port with localhost:port in "View on IPFS Gateway"



  • We could have something similar if gateway is 0.0.0.0, then we replace it with window.location.hostname or replace both host and port with window.location.host

How does that sound?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jessicaschilling picture jessicaschilling  ·  5Comments

mxdpeep picture mxdpeep  ·  5Comments

surajrav picture surajrav  ·  6Comments

jessicaschilling picture jessicaschilling  ·  4Comments

Luflosi picture Luflosi  ·  3Comments