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

Absolute redirects on ipns://example.com (and ipfs://) lead to http://127.0.0.1:8080/redirect-target.html instead of ipns://example.com/redirect-target.html #12015

Closed
ilyaigpetrov opened this issue Oct 6, 2020 · 6 comments

Comments

@ilyaigpetrov
Copy link

ilyaigpetrov commented Oct 6, 2020

Description

Absolute redirects on ipns://example.com (and maybe on ipfs://) lead to http://127.0.0.1:8080/redirect-target.html instead of ipns://example.com/redirect-target.html.

I've made a domain for demonstration:

https://brave-redirect-bug.ilyaigpetrov.tk -> redirects to -> https://brave-redirect-bug.ilyaigpetrov.tk/foobar.html
ipns://brave-redirect-bug.ilyaigpetrov.tk -> redirects to -> http://127.0.0.1:8080/foobar.html which is a broken link.

Steps to Reproduce

  1. Turn off native ipfs daemon in brave nightly or use another browser.
  2. Visit https://brave-redirect-bug.ilyaigpetrov.tk which is connected to ipns via _dnslink and see it redirects to foobar.html
  3. Turn on native ipfs daemon in brave nightly, launch it.
  4. Visit ipns://brave-redirect-bug.ilyaigpetrov.tk and see it redirects to a wrong URL.

Actual result:

ipns://brave-redirect-bug.ilyaigpetrov.tk redirects to http://127.0.0.1:8080/foobar.html which is a broken link.

Expected result:

ipns://brave-redirect-bug.ilyaigpetrov.tk should redirect to ipns://brave-redirect-bug.ilyaigpetrov.tk/foobar.html

Reproduces how often:

Every time I try it.

Brave version (brave://version info)

Brave | 1.17.13 Chromium: 86.0.4240.68 (Official Build) nightly (64-bit)
Revision | ad72ee9aa8e15ed300df1238e76c7a8f4d686f97-refs/branch-heads/4240@{#1097}
OS | Linux

Version/Channel Information:

  • Can you reproduce this issue with the current release?
    Native IPFS is not implemented I guess.
  • Can you reproduce this issue with the beta channel?
    Native IPFS is not implemented I guess.
  • Can you reproduce this issue with the nightly channel?
    Yes.

UPD

The same problem with ipfs://, see:
ipfs://QmRHZEnj9tpdjqE38VENyHq2Bz33QsBSi3oQSyMXvqL9XC -> redirects to -> http://127.0.0.1:8080/foobar.html which is a broken URL.

@yrliou
Copy link
Member

yrliou commented Nov 10, 2020

@ilyaigpetrov Could you try again on our latest nightly? I used my local build with Brave version 1.18.44 and it redirects to http://brave-redirect-bug.ilyaigpetrov.tk.ipns.localhost:48080/foobar.html for me. I used the local build instead of public nightly because I can't seem to access the content you host at that domain right now, and my local build probably already have the content cached when I try to access it yesterday.

Update: I'm able to access it through my nightly now (Brave Version 1.18.46) and it also redirects for me, so please check again on your end to see if it's fixed, thanks!

@ilyaigpetrov
Copy link
Author

@yrliou, yes, it redirects correctly now. However I expected ipns://brave-redirect-bug.ilyaigpetrov.tk to be redirected to ipns://brave-redirect-bug.ilyaigpetrov.tk/foobar.html, not http://brave-redirect-bug.ilyaigpetrov.tk.ipns.localhost:48080/foobar.html. Should I create a new issue for this or just leave this one open?

@ilyaigpetrov
Copy link
Author

And there is also this case to be considered:

  1. E.g. ipns://ilyaigpetrov.tk returns:
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Redirecting...</title>
    <script>
      window.location.hostname = 'www.' + window.location.hostname;
    </script>
    <body>
      Redirecting...
    </body>
  </head>
</html>
  1. Then visiting ipns://ilyaigpetrov.tk must redirect you to ipns://www.ilyaigpetrov.tk, not to http://www.ilyaigpetrov.tk.ipns.localhost:48080 as it does currently.

@bbondy
Copy link
Member

bbondy commented Nov 27, 2020

@ilyaigpetrov on Nightly, it'll now show up in the URL bar as ipns:// even know it uses http://www.ilyaigpetrov.tk.ipns.localhost:48080 internally. Is there a downside to this from your point of view? Or are you ok with that?

@ilyaigpetrov
Copy link
Author

@bbondy, thanks, it now works as expected.
I don't see any downside with it (what downside do you mean?)

@bbondy
Copy link
Member

bbondy commented Nov 28, 2020

I was just attempting to see if there was an unknown unknown. Thanks for checking and for the issue. I'll close this as fixed by brave/brave-core#7191

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants