in-web-browsers
in-web-browsers copied to clipboard
localhost subdomains do not work on Safari (macOS)
Version information:
go-ipfs version: 0.6.0 Repo version: 10 System version: amd64/darwin Golang version: go1.14.4
Description:
After 0.6.0 version local gateway started redirecting to localhost subdomains (guessing ipfs/kubo#651) e.g. going to following address http://localhost:8080/ipfs/QmTQ1PTYhZNt9q7bJ1r6R18ctj6NoHTzvqdLgiq2UzRZHU/ redirects to http://bafybeicle2hoymo7rsqf7w5mjyssntevvwpylixlri63azrppm6lzv7vvm.ipfs.localhost:8080/ which fails in Firefox
And in Safari
Although it does work in Chrome.
As per @lidel
..this is known problem on some platforms with combo of strict DNS resolver and browser vendors who don't implement "let localhost be localhost" 6.3.3 @ https://tools.ietf.org/html/rfc6761#section-6.3 (upstream bug for Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1220810) Until that is resolved, the localhost subdomain fix is to use go-ipfs' Gateway port as HTTP proxy for loading *.localhost websites – that way we avoid using OS DNS resolver that fails to resolve *.localhost hostnames (If you have IPFS Companion installed in Firefox, it will set up proper proxy automatically) (edited) Follow updates in https://github.com/ipfs/in-web-browsers/issues/109#issuecomment-717248720
Despite proxy solution, I think this is a major regression. People installing IPFS for the first time will not know this and even knowing this they may not want to use IPFS as proxy (maybe they don't want to have IPFS running all the time, or have other reasons).
I think only reasonable solution would be not to redirect until known issues are resolved or only redirect requests coming from chrome (until Firefox, Safari support this)
Can anyone with windows machine check if default browser there handles this properly ?
Found a corresponding Safari bug https://bugs.webkit.org/show_bug.cgi?id=160504 and posted a comment.
Per @rafaelramalho19 it works with default windows browser

same here... my code look for http://localhost:8080/ipfs/QmWq7GRWzZDKqeHsuCkrMG4cWV4dintmRpewxESjH1rGJR it would fail to access with safari and firefox, and i have to force it to redirect to https://ipfs.io/ipfs/QmWq7GRWzZDKqeHsuCkrMG4cWV4dintmRpewxESjH1rGJR this would defeat the purpose of decentralized... and burden the ipfs.io gateway.
another similar problem, Safari would fail in https / port 443... even if CORS was set, and working in all other browser, Safari alone would fail to access.
can refer the details here https://github.com/ipfs/js-ipfs/issues/3154
Per @rafaelramalho19 it works with default windows browser
this is bcos Edge browser is Chromium based... all Chromium based browser is working without problem.
another related problem, for orbit-db to connect via ipfs-http-client to go-ipfs
https://github.com/orbitdb/orbit-db/issues/818
and this must set allow-origin to * in order to even work for chromium... and yes only chromium based browser will work. safari wont work either with *
@thienpow
- for what it's worth, you should be able to use http://127.0.0.1:8080/ipfs/QmWq7GRWzZDKqeHsuCkrMG4cWV4dintmRpewxESjH1rGJR in Firefox without the problem. Subdomains are useful only when you need Origin isolation.
- orbit issue does not seem to be related to localhost subdomains: if you believe there is a bug in go-ipfs, please fill a separate issue
@thienpow
- for what it's worth, you should be able to use http://127.0.0.1:8080/ipfs/QmWq7GRWzZDKqeHsuCkrMG4cWV4dintmRpewxESjH1rGJR in Firefox without the problem. Subdomains are useful only when you need Origin isolation.
- orbit issue does not seem to be related to localhost subdomains: if you believe there is a bug in go-ipfs, please fill a separate issue
the problem is like what Gozala mentioned, go-ipfs forcefully redirect http://127.0.0.1:8080/ipfs/{cid} to bafy...ipfs.localhost:8080 this is not what i want or my choice or my code to do it.
if go-ipfs 0.6 do not forcefully redirect to subdomain, original url http://127.0.0.1:8080/ipfs/{cid} would work
Firefox confirm won't work too, i paste http://localhost:8080/ipfs/QmWq7GRWzZDKqeHsuCkrMG4cWV4dintmRpewxESjH1rGJR but it redirect to http://bafybeid6e7eu7ol662vq3s4p5t52urtzaxf2w7qxmtss6xqrhrotykzewy.ipfs.localhost:8080/
If you have IPFS Companion installed and enabled it will set up proxy in Firefox and default to subdomain gateway, but go-ipfs 0.5+ at http://127.0.0.1:8080/ipfs/QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR (raw IP) does not redirect on its own.
If you want to make requests to local gateway that do not use subdomains and work in every browser without proxy/extension, make sure you use 127.0.0.1 instead of localhost for now.
i don't have companion installed... it's automatic redirect with go-ipfs 0.6.0 for the localhost and yes 127.0.0.1 won't be redirected
I'm using IPFS Companion with Firefox 80.0.1 and go-ipfs 0.6.0 on Peppermint 10 Respin (Lubuntu-based), and neither localhost:8080 nor 127.0.0.1:8080 work unless I turn off the local gateway. Localhost subdomains do work, regardless of whether the local gateway is on or off.
I'm not sure if this is a related issue, but I'm also having problems access IPFS Localhost from the command line on Windows.
If I run:
git clone http://QmYgyahQoikJEbZEkiubwxm16xjCAZs2RUd1qfuus2Zyeq.ipfs.localhost:8080/
Or:
git clone http://localhost:8080/ipfs/QmYgyahQoikJEbZEkiubwxm16xjCAZs2RUd1qfuus2Zyeq
I get the following error message:
fatal: unable to access 'http://QmYgyahQoikJEbZEkiubwxm16xjCAZs2RUd1qfuus2Zyeq.ipfs.localhost:8080/': Could not resolve host: QmYgyahQoikJEbZEkiubwxm16xjCAZs2RUd1qfuus2Zyeq.ipfs.localhost
However, I have managed to get it working by running:
git clone http://127.0.0.1:8080/ipfs/QmYgyahQoikJEbZEkiubwxm16xjCAZs2RUd1qfuus2Zyeq
This seems to be the same issue(#7697) as I mentioned
All localhost will be resolved and then redirected
In addition, if it is a local ip address(192.168.xxx.xxx), it seems to be resolved and then redirected.
The remote ip address(192.168.xxx.xxx) will not do this.
I'm on Firefox 81.0 and go-ipfs 0.7.0 now, and no longer having this problem.
I'm on Firefox 81.0 and go-ipfs 0.7.0 now, and no longer having this problem.
I still have the problem on Firefox 81.0 (64) and windows 10 and go-ipfs 0.8.0-dev, are you using an address like 127.0.0.1:8080/ipfs/xxxx instead of localhost:8080/ipfs/xxxx
These two give me different results
I'm on Firefox 81.0 and go-ipfs 0.7.0 now, and no longer having this problem.
I still have the problem on Firefox 81.0 (64) and windows 10 and go-ipfs 0.8.0-dev, are you using an address like
127.0.0.1:8080/ipfs/xxxxinstead oflocalhost:8080/ipfs/xxxxThese two give me different results
They both work for me now.
This seems to be the same issue(#7697) as I mentioned
They're not, as @lidel explained that issue is related to the fact that the software you are using doesn't follow HTTP redirects. The suggestion to use an IP address instead of localhost there was simply so there would not be a redirect and so you could deal with the bugs in your video player.
They both work for me now.
@Asherathe are you sure you're testing without IPFS Companion enabled? Everything works fine if IPFS companion is enabled, but if you turn it off in Firefox and then go to localhost:8080/ipns/ipfs.io/ I suspect you'll get an error (at least I do on Windows 10 + Firefox 81)
@Asherathe are you sure you're testing without IPFS Companion enabled? Everything works fine if IPFS companion is enabled, but if you turn it off in Firefox and then go to localhost:8080/ipns/ipfs.io/ I suspect you'll get an error (at least I do on Windows 10 + Firefox 81)
I had reported here before that I was having the same problem with localhost:8080, even though IPFS Companion was enabled. That's no longer the case. That's the main point I was trying to communicate. With IPFS Companion disabled, the problem does still exist. Apologies for confusing things.
Hi, could someone with MacOS Sonoma 14.2 (or later) and either with Safari 17.1.2 and Safari Technology Preview 184 (or later) confirm if this insteed was fixed upstream?
https://bugs.webkit.org/show_bug.cgi?id=160504#c5