Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some URL don't get redirected to the local Web-Gateway #877

Closed
RubenKelevra opened this issue May 6, 2020 · 8 comments · Fixed by #959
Closed

Some URL don't get redirected to the local Web-Gateway #877

RubenKelevra opened this issue May 6, 2020 · 8 comments · Fixed by #959
Labels
kind/bug A bug in existing code (including security flaws) status/blocked/upstream-bug Blocked by upstream bugs

Comments

@RubenKelevra
Copy link

Describe the bug
I use a simple URL redirect by my domain provider, to avoid having to run a webserver myself. The redirect looks like this:

http://abc.domain.tld -> HTTP302 -> https://ipfs.io/ipns/abc.domain.tld/

This is currently not caught by the ipfs-companion and the content is fetched from the ipfs.io web gateway.

My domain has a DNSLink-Entry to an IPNS-CID. Using this IPNS-CID directly (to ipfs.io) as a link works.

Demo-Link-Working

Demo-Link-Broken with DNSLink IPNS

Demo-Link-Broken with forward

DNSData:

[ruben@i3 ~]$ nslookup -TYPE=TXT pkg.pacman.store
Server:		8.8.8.8
Address:	8.8.8.8#53

Non-authoritative answer:
pkg.pacman.store	text = "dnslink=/ipns/QmfYwNBmDaGXP8cxTRxoSmGkYQFRFT4HjeeFjMvc9Y4KHq"
pkg.pacman.store	text = "1|https://ipfs.io/ipns/pkg.pacman.store/"

Authoritative answers can be found from:

Expected behavior
All 3 demo links should load the data from the local gateway.

Desktop (please complete the following information):

  • OS: ArchLinux
  • Browser Brave
  • Version 2.11.0
@RubenKelevra RubenKelevra added the need/triage Needs initial labeling and prioritization label May 6, 2020
@lidel
Copy link
Member

lidel commented May 14, 2020

@RubenKelevra I believe the issue is not caused by the redirect, but your DNS TXT records and the way DNSLink resolution works in go-ipfs.

http://localhost:8080/api/v0/dns/pkg.pacman.store?r=true in go-ipfs 0.5.0 returns:

{"Message":"not a valid domain name","Code":0,"Type":"error"}

Some ideas:

  • What is the purpose of 1|https://ipfs.io/ipns/pkg.pacman.store/ TXT record?
    I suspect it may be the source of problem (perhaps it revealed a bug in the way we parse TXT records that are not related to dnslink?
  • Can you move DNSLink record from the main domain at pkg.pacman.store to _dnslink.pkg.pacman.store ? (may fix the issue, as there won't be any other TXT records to interfere)

Let me know if any of this helped.

@lidel lidel added the need/author-input Needs input from the original author label May 14, 2020
@lidel
Copy link
Member

lidel commented May 14, 2020

@RubenKelevra Also, you mention:

I use a simple URL redirect by my domain provider, to avoid having to run a webserver myself.

You don't need to run server youself. Just point DNS CNAME record at any public gateway and unless it censors Host header, it will load.

Not all gateway provides give TLS for such setups, but I believe Cloudflare does:
https://developers.cloudflare.com/distributed-web/ipfs-gateway/connecting-website/ → see "Make It All Secure" section.

This should give you https://pkg.pacman.store backed by Cloudflare's gateway

@lidel
Copy link
Member

lidel commented Jun 5, 2020

@RubenKelevra any update on this?

@lidel lidel removed the need/triage Needs initial labeling and prioritization label Jun 5, 2020
@RubenKelevra
Copy link
Author

RubenKelevra commented Jun 8, 2020

  • What is the purpose of 1|https://ipfs.io/ipns/pkg.pacman.store/ TXT record?
    I suspect it may be the source of problem (perhaps it revealed a bug in the way we parse TXT records that are not related to dnslink?

This is the way the hoster implement redirects with DNS. IPFS should ignore this record, as it isn't a dnslink-record.

  • Can you move DNSLink record from the main domain at pkg.pacman.store to _dnslink.pkg.pacman.store ? (may fix the issue, as there won't be any other TXT records to interfere)

I've changed my DNS to this. Didn't change anything. Another idea @lidel ?

This should give you https://pkg.pacman.store backed by Cloudflare's gateway

I can't use the Cloudflare gateway. It's for hours unable to receive a perfectly working IPNS record for no apparent reason.

See https://discuss.ipfs.io/t/difficulties-with-the-cloudflare-gateway/7211

@lidel
Copy link
Member

lidel commented Jun 8, 2020

Hm.. I filled ipfs/kubo#7439

That upstream bug is the root of the problem. IPFS Companion does not redirect to local gateway, because it gets false-negative from /api/v0/dns/pkg.pacman.store:

2020-06-08--13-36-07

@lidel lidel added kind/bug A bug in existing code (including security flaws) status/blocked/upstream-bug Blocked by upstream bugs and removed need/author-input Needs input from the original author labels Jun 8, 2020
@Ktl-XV
Copy link
Contributor

Ktl-XV commented Jan 2, 2021

I quickly changed the api endpoint to /api/v0/name/resolve/, repackaged the extension and it worked correctly in Chromium. I don't know enough to be sure if there are any side effects of this change. Can a member of the project explain if this is an option?

@jessicaschilling
Copy link
Contributor

@lidel Can you please advise?

@lidel
Copy link
Member

lidel commented Jan 15, 2021

Good catch! I believe there are no side effects.

@Ktl-XV would you like to submit a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) status/blocked/upstream-bug Blocked by upstream bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants