ipfs-desktop icon indicating copy to clipboard operation
ipfs-desktop copied to clipboard

IPFS Scheme Handler Routes "ipfs://<hash>" to "http://127.0.0.1:8081/<hash>/" while it should route to "http://<hash>.ipfs.localhost:8081/"

Open KillariDev opened this issue 2 years ago • 2 comments

  • OS: Windows
  • Version of IPFS Desktop 0.32.0

Describe the bug IPFS Scheme Handler Routes "ipfs://" to "http://127.0.0.1:8081//" while it should route to "http://.ipfs.localhost:8081/"

To Reproduce

  1. Have Scheme handler installed with IPFS desktop
  2. Go to Eg, ipfs://bafybeia3ly2pwdukzwufnof3utydapssmf3eco6sciylew3vd5rg55uxji on Firefox
  3. Accept the dialog
  4. Observe firefox opening page http://127.0.0.1:8081/bafybeia3ly2pwdukzwufnof3utydapssmf3eco6sciylew3vd5rg55uxji/ while it should go to http://bafybeia3ly2pwdukzwufnof3utydapssmf3eco6sciylew3vd5rg55uxji.ipfs.localhost:8081/ instead

KillariDev avatar Jan 04 '24 07:01 KillariDev

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review. In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment. Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

  • "Priority" labels will show how urgent this is for the team.
  • "Status" labels will show if this is ready to be worked on, blocked, or in progress.
  • "Need" labels will indicate if additional input or analysis is required.

Finally, remember to use https://discuss.ipfs.io if you just need general support.

welcome[bot] avatar Jan 04 '24 07:01 welcome[bot]

Thanks for submitting this issue @KillariDev, I see what you mean and I am not sure if this is a bug. This redirect happens based on this blob of code: https://github.com/ipfs/ipfs-desktop/blob/main/src/protocol-handlers.js#L19-L21. This ipfsd.gatewayAddr is the gateway multiaddr, which is /ip4/127.0.0.1/tcp/8081 in your case and the redirect happens as expected. However, this is not what you expected and that is understandable.

This behaviour is corrected by ipfs-companion which as the name suggests is a companion to ipfs implementations like kubo (that's what ipfs-desktop runs too). I didn't even notice this at first because I had the companion enabled.

However, I think this could be an additional feature, which allows overriding the gateway address to a custom address (localhost or a domain).

whizzzkid avatar Jan 04 '24 21:01 whizzzkid