Firefox redirects localhost to HTTPS
Asked Answered
E

11

52

There is a similar question about the same issue on Chrome, with an answer that solves it in Chrome.

When I try to go to http://localhost:8000/, Firefox redirects me to https://localhost/ . Why? If I open an incognito window, this doesn't happen. I can't continue developing until I solve this. Please help.

Errecart answered 3/8, 2016 at 21:43 Comment(1)
Sadly, it appears a Private/incognito window no longer works around this issue.Ministration
F
32

So, here is my experience. I had the same issue.

At first : try in private mode. If you dont have the problem, do this :

When you open a new tab, you have to go to the Firefox configuration ("about:config") you check "I'll be careful I promise". Then in the search field you type autofill, you have to set browser.urlbar.autofill to false and if it still doesn't work you can delete the history, it should fix it. It worked for me.

I think the problem comes from the fact that I opened once localhost in https so the browser wants to do it every time.

Funderburk answered 4/8, 2016 at 13:5 Comment(2)
None of those worked for me (I have the problem not with localhost/ but with a domain, that I redirected to localhost in my /etc/hosts/ file) It seems to be a hsts problem, cause I could solve it in Chrome like this: https://mcmap.net/q/36018/-google-chrome-redirecting-localhost-to-httpsRenny
It worked for me after I set it to false and deleted the history also. My problem was the redirect from localhost:8080/ to localhost:8080/auth/.Explode
B
54

This happened to me after I worked on a site that used https and then tried switching back to one that does not.

Unfortunately, the accepted answer did not work for me. What I needed to do was:

  1. Open the Firefox History (ctrl+h)
  2. Find the page (127.0.0.1:3000, in my case)
  3. Right-click it and choose the last option: "Forget About This Site"

If you use localhost - with our without port - to access your page, then you will notice that localhost does not show up in your history. This makes it impossible to access the "Forget About This Site" option.

Fear not! You can work around that issue.

  1. Visit your site using 127.0.0.1 instead of localhost. So, for example, localhost:3000 becomes 127.0.0.1:3000.
  2. Now open the Firefox History (ctrl+h)
  3. Find the page (127.0.0.1), right-click, and "Forget About This Site"
  4. Now, access localhost and you will find that it works again. This is because forgetting about 127.0.0.1 cleared data for both 127.0.0.1 as well as for localhost.
Briannebriano answered 31/7, 2017 at 5:57 Comment(4)
I tried the accepted answer first, but only yours actually fixed the problem for me. Cheers.Ops
this is the solution that works for me on Mac OS Big Sur 11.4Etui
127.0.0.1 doesn't even show up in history for meDiagnosis
only this answer allowed me to access again a site with http. rightclick and choose "forget complete webseite"Joycelynjoye
F
32

So, here is my experience. I had the same issue.

At first : try in private mode. If you dont have the problem, do this :

When you open a new tab, you have to go to the Firefox configuration ("about:config") you check "I'll be careful I promise". Then in the search field you type autofill, you have to set browser.urlbar.autofill to false and if it still doesn't work you can delete the history, it should fix it. It worked for me.

I think the problem comes from the fact that I opened once localhost in https so the browser wants to do it every time.

Funderburk answered 4/8, 2016 at 13:5 Comment(2)
None of those worked for me (I have the problem not with localhost/ but with a domain, that I redirected to localhost in my /etc/hosts/ file) It seems to be a hsts problem, cause I could solve it in Chrome like this: https://mcmap.net/q/36018/-google-chrome-redirecting-localhost-to-httpsRenny
It worked for me after I set it to false and deleted the history also. My problem was the redirect from localhost:8080/ to localhost:8080/auth/.Explode
H
17

I'm running MAMP on OSX with default ports (http://localhost) and what worked for me was changing this preference to false on about:config:

browser.fixup.fallback-to-https

I tried clearing History, Site Preferences, changing browser.urlbar.autofill and network.stricttransportsecurity.preloadlist, disabling all extensions, but none of these worked.

Homily answered 13/10, 2020 at 15:8 Comment(2)
Worked for me too, on 78.8, on CentOS 8Pictorial
Worked for me with Ventura 13.0.1 and FF108.Addictive
S
7

In their last update, Chrome and Firefox browsers now redirect all domains with the pattern *.dev and *.foo to https. I found a solution for Firefox but, haven't yet found a solution for Chrome.

for Firefox

Visit the address about:config
Search for the parameter network.stricttransportsecurity.preloadlist and change it's value to false

Since this question refers to a localhost, alternative solutions involve:

  • Change your URLs and use new domains .
  • Modify the hosts file, If you point on IP addresses or virtual hosts, you can modify your hosts file to use local domains
  • Or, Use SSL, you can choose to activate SSL on your web server.

Source: https://tutoref.com/how-to-prevent-firefox-and-chrome-from-forcing-dev-and-foo-domains-to-use-https/

Skulk answered 27/9, 2018 at 3:4 Comment(4)
I tried this, but it had no effect. it still redirects my test-domain foo.example.com to foo.example.com – maybe because the domain really exists, and I just redirected it to localhost in my hosts file?Renny
This fixed my issue. I was using .home domain for my self-hosted servers ,so it isn't limited to only the .dev domain.Penzance
This is the only thing worked for me - and the context was I added dev to my /etc/hosts to resolve to 127.0.0.1 because I want to use a host header with nginx instead of a raw IP.Edeline
Did not work for me (Firefox 120)Davit
G
7

The solution that worked for me:

  1. Go to about:config
  2. Look for network.stricttransportsecurity.preloadlist and set it to "false"
  3. Enjoy
Gonnella answered 4/11, 2020 at 19:54 Comment(3)
This is the only one that worked for me! Thanks, Reza!Dissogeny
This one worked for me on 87.0 (64-bit) on Arch Linux. Thank you Reza Shek! =)Eubank
This is the only thing worked for me - and the context was I added dev to my /etc/hosts to resolve to 127.0.0.1 because I want to use a host header with nginx instead of a raw IP.Edeline
F
1

To connect to a Pluto.jl instance, the only workaround so far was to launch in a private window:

firefox -new-instance -P Pluto --private-window http://localhost:1237

Finns answer fixed it once, but subsequent calls timed out.

Comments left in a relevant bug report.

Freezer answered 27/5, 2021 at 12:49 Comment(0)
S
1

In my case, the issue was fixed by restarting the Apache web server.

Stoop answered 5/7, 2021 at 2:26 Comment(0)
C
0

enter image description here

What ended up working for me was toggling Enhanced Tracking Protection to OFF via the shield icon in the address bar. I did this for both localhost and the site that it was redirecting to. Hope this helps someone.

Course answered 8/8, 2022 at 19:29 Comment(0)
F
0

I tried the top answer and deleting individual history didn't do the trick for me. I tried deleting history from localhost, 127.0.0.1, and 0.0.0.0, but still saw the issue. When I cleared all of my history, the issue went away.

Farmland answered 17/12, 2022 at 23:19 Comment(0)
U
0

This worked for me: enter image description here

I pressed on the "Clear cookies and site data..." and then remove on the pop-up.

Cheers!

Undertow answered 30/11, 2023 at 11:59 Comment(0)
S
0

Just clearing cache seemed to fix this for me i.e. Settings -> History -> Clear history and uncheck everything except Cache.

enter image description here

Scherer answered 27/5 at 6:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.