Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Unable to connect to localhost aliased sites

more options

On my dev system (windows), I have an apache server and a number of sites defined.

They are listed in the hosts file and also configured in httpd-vhosts.conf.

I have had to stay with an old version of Firefox for the last few years, as more recent versions refused to connect to the localhost sites. I have been "forced" to upgrade and am nolonger able to connect to the local sites. I precise that doing a ping to the site address will return the 127.0.0.1 address.

What do I have to do to get this important functionality working again, please ?

On my dev system (windows), I have an apache server and a number of sites defined. They are listed in the hosts file and also configured in httpd-vhosts.conf. I have had to stay with an old version of Firefox for the last few years, as more recent versions refused to connect to the localhost sites. I have been "forced" to upgrade and am nolonger able to connect to the local sites. I precise that doing a ping to the site address will return the 127.0.0.1 address. What do I have to do to get this important functionality working again, please ?

All Replies (7)

more options

What's the exact error message?

If the server can't be found:

As long as your DNS resolution is running through Windows, the host names in hosts should work. Three ways Firefox might bypass Windows DNS resolution are:

(A) Using DNS-over-HTTPS "only" (very unusual) (B) Using a system-wide VPN or extension-based VPN (C) Configuring Firefox's connection settings

For C, you can check here:

  • Windows: "3-bar" menu button (or Tools menu) > Options
  • Mac: "3-bar" menu button (or Firefox menu) > Preferences
  • Linux: "3-bar" menu button (or Edit menu) > Preferences
  • Any system: type or paste about:preferences into the address bar and press Enter/Return to load it

In the search box at the top of the page, type proxy and Firefox should filter to the "Settings" button, which you can click.

The default of "Use system proxy settings" piggybacks on your Windows/IE "LAN" setting. "Auto-detect" can lead to a flaky connection. You may want to try "No proxy".

Any difference?

If the server does not respond:

Please check Firefox's Web Console and Network Monitor tools for any clues about the problem. Also, do your web server logs show any indication of a request?

more options

Hi,

Thank you for your input. So, to answer your questions :

  • message is indeed "Unable to connect - Firefox can’t establish a connection to the server ..."
  • network proxy set to "no proxy"
  • the web console shows no information
  • the network console only shows a bar on the "blocked" line under the timings section
  • no entries in any web server log

The really looks like firefox is not getting any info from the hosts file when doing it's dns resolution. Any thoughts ?

more options

Hi Simon_Giddings, I think a DNS issue would look different. You can test by using an address like:

http://no-way-does-this-resolve/

On the Network Monitor entry, if you click that one line, on the right side, on the Headers panel, does it show the expected IP address? Or maybe that panel isn't populated if the connection fails.

more options

Hi jscher2000,

You are right, the headers panel does not contain any IP address.

I hasten to add that the upgrade of firefox is the only change done on my system.

So ideas about firewalls, apache software or any other form of network blocking software shouldn't come into the equation really.

I find it difficult to believe that firefox would have "cut out" this connectivity aspect.

more options

I can't readily replicate your environment, so I'm going to have to suggest some more work on your end.

There are two main components for troubleshooting:

(1) Current profile with customized settings and add-ons (2) Program files, occasionally corrupted during an update

So we often recommend testing a new profile or doing a clean reinstall of the program files so you can see how a "vanilla" Firefox behaves in your environment. Naturally, one at a time provides more information than doing everything at once.

New Profile Test

This takes about 3 minutes, plus the time to test your problem site(s).

Inside Firefox, type or paste about:profiles in the address bar and press Enter/Return to load it.

Click the Create a New Profile button, then click Next. Assign a name like April2019, ignore the option to relocate the profile folder, and click the Finish button.

After creating the profile, scroll down to it and click the Set as default profile button below that profile, then scroll back up and click the Restart normally button. (There are some other buttons, but please ignore them.)

Firefox should exit and then start up using the new profile, which will just look brand new. Please ignore any tabs enticing you to connect to a Sync account or to activate extensions found on your system so we can get a clean test.

Do your problem site(s) work any better in the new profile?

When you are done with the experiment, open the about:profiles page again, click the Set as default profile button for your normal profile, then click the Restart normally button to get back to it.

Clean Reinstall

This takes about 5 minutes. It's not about your settings, it's about making sure the program files are clean (no inconsistent or alien code files). As described below, this process does not disturb your existing settings. It's not essential to uninstall Firefox, but you can if you like, saying No to any request about removing personal data.

(A) Download a fresh installer for Firefox to a convenient location:

https://www.mozilla.org/firefox/all/

(B) Exit out of Firefox (if applicable).

If you use Microsoft Office, please change your default browser to Internet Explorer temporarily before the next step.

(C) Using Windows Explorer/My Computer (hold down the Windows key and press E to launch it), right-click > rename the program folder as follows (you might have one or both):

C:\Program Files (x86)\Mozilla Firefox =to=> C:\Program Files (x86)\OldFirefox

C:\Program Files\Mozilla Firefox =to=> C:\Program Files\OldFirefox

(D) Run the installer you downloaded in step (A). It should automatically connect to your existing settings.

Any improvement at your next startup?

more options

Thank you for your advice.

I have tried all suggestions ... with no improvement - still cannot connect.

more options

I wish I had remembered this tool earlier...

Could you test your hostname on this internal page (I can't make it a link, you need to copy/paste to the address bar and load it from there):

about:networking#dnslookuptool

That page also has a logging feature described in the following article:

https://developer.mozilla.org/docs/Mozilla/Debugging/HTTP_logging

I haven't used it for a few years, but I recall it being extremely verbose.