Last Comment Bug 339814 - Offline mode prevents access to localhost
: Offline mode prevents access to localhost
Status: RESOLVED DUPLICATE of bug 1140284
Product: Core
Classification: Components
Component: Networking (show other bugs)
: Trunk
: All All
-- normal with 20 votes (vote)
: ---
Assigned To: Daniel Stenberg [:bagder]
: Patrick McManus [:mcmanus]
: 440527 461156 529861 535734 539541 (view as bug list)
Depends on: 87717 1140284
Blocks: cuts-cruft 546640
  Show dependency treegraph
Reported: 2006-05-31 08:08 PDT by Darin Fisher
Modified: 2015-07-16 13:47 PDT (History)
48 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

firefox-local-hosts-bug.png (89.26 KB, image/png)
2014-08-04 22:33 PDT, Hendy Irawan
no flags Details

Description User image Darin Fisher 2006-05-31 08:08:32 PDT
Offline mode prevents access to localhost

Right now, we just have a global online/offline boolean to control whether or not we have the ability to open sockets and make DNS requests.  This prevents us from browsing localhost while "offline".

With auto-detection of offline mode, I think this bug will end up getting more visibility.
Comment 1 User image Wolfgang Rosenauer [:wolfiR] 2007-01-21 22:53:01 PST
Seconded. Since Novell is shipping autodetection of the network status there are some reports that local webapplications are not accessible.
This is nothing new.
Bug 87717 is about the same problem.
Comment 2 User image Darin Fisher 2007-06-11 00:34:48 PDT
-> reassign to default owner
Comment 3 User image Mikolaj 2008-06-02 13:52:44 PDT
is there anything that could be done about not being able to access localhost when there is no Internet connection? it is really anoying...! Because of this I HAVE TO use M$$ browser (or Opera...) :((((  and I like my Firefox very much... 
Comment 4 User image Robert O'Callahan (:roc) (email my personal email if necessary) 2008-06-02 15:01:12 PDT
You can manually uncheck "work offline".
Comment 5 User image cwsulliv 2008-06-05 04:51:57 PDT
It is darned annoying to have to manually uncheck "work offline" every time I start FF when I'm disconnected from the local network!  Please provide an option to disable automatic switching to offline mode.

Comment 6 User image Christian :Biesinger (don't email me, ping me on IRC) 2008-06-05 06:37:15 PDT
once you uncheck work offline, firefox no longer automatically switches between offline and online (until you restart it)
Comment 7 User image cwsulliv 2008-06-05 11:44:20 PDT
(In reply to comment #6)
> once you uncheck work offline, firefox no longer automatically switches between
> offline and online (until you restart it)

This is true.  But I don't keep FF open when I'm not using it, and as I stated it's darned annoying to have to uncheck the box each time I start it.

As a Linux user, I find it quite unusual that a Linux app with the quality of FF is lacking a configuration option to disable having the app automatically make decisions like this for me.

Comment 8 User image Steve White 2008-07-02 21:45:39 PDT
In my case, "work offline" comes up selected whether I'm connected to a network or not.  I have to un-check it every time I start Firefox in order to browse the web.

The only thing I found that sort of fixed it was to have Network Manager running first, turn off offline mode there, then start Firefox.  But that is only a per-session solution.

Here is a list of discussions of the topic:
Comment 9 User image benc 2008-07-08 21:11:10 PDT
Darin: isn't this a dupe of Bug 87717?
Comment 10 User image Adria 2008-08-08 01:15:59 PDT
Hello, Im using Firefox 3.0.1 and Windows XP and I use a lot local websites with no internet connection. I have the Offline problem all the time and I have to uncheck the work offline option. But everytime I restart Firefox I have to do the same again.

I tried with localhost and with and everytime happens the same. Why this option is not saved and how I can solve this problem? Is that a bug?
Comment 11 User image Matt 2008-08-15 17:59:50 PDT
Have there been any updates to this? This is also driving me crazy. 
Comment 12 User image benc 2008-08-19 21:05:25 PDT
We need to break out the user data by platform. I have a feeling linux users feel it more because they have some new network-detection features...
Comment 13 User image Steve White 2008-08-26 03:01:41 PDT
The problem has largely gone away for me.  Firefox still gets into offline mode, but only when I start it with the network down, which makes more sense.  

I've changed a lot of stuff, and I don't know what change improved the situation.  Here is what I can think of:

I'm now running Ubuntu 8.04 Hardy Heron; when I reported before, I was at 7.10 Gutsy Gibbon.  I also updated Firefox from 3.0 to 3.0.1.

Besides that, I did a sort of purge of files from my ~/.mozilla/firefox/ directory, that seemed no longer to be used.

But... Windows users are reporting a similar problem with FF 3.0.1... the common denominator would be the .mozilla/firefox directory...
Comment 14 User image Gervase Markham [:gerv] 2008-08-26 09:06:31 PDT
benc is right: on Linux, Firefox now responds to dbus messages from Network Manager, which means that if you disconnect the network cable, Firefox goes offline and you can't access your locally-served resources.

I think an exception for and localhost would cover 99% of the cases. We could even make the list of exceptions a pref for the tiny number of people who have other local aliases for their own machine.

Comment 15 User image Pander 2008-09-10 08:16:41 PDT
I experienced this when travelling by train. After booting my Ubuntu Hardy Heron system, it detects no wired (default) or wireless networks and therefore Firefox 3 is set to normal mode. When the train stops at a station that has a wireless network, even though I don't (try to)access it, the system is not really influenced by this. However when the wireless network goes out of reach, Firefox detects the network has gone when accessing localhost and switches to 'working offline'.

In short, like many other argue, Firefox accessing localhost should not be effected by this. I would like to propose, like others, that accessing localhost is considered like accessing an URL on the local file system.

If one really needs the behaviour that localhost is considered an external URL, it should be possible to enable this functionality somewhere in the preference menu's.
Comment 16 User image Pander 2008-09-10 08:19:03 PDT
Perhaps another issue, but slightly related to this is, is caching for localhost. Should caching be used for local files and localhost usage? For developers it is desirable to have caching disabled in these cases. For normal users and in general, not using cache in these cases is probably faster anyway.
Comment 17 User image Håkan Waara 2008-10-22 07:24:25 PDT
*** Bug 461156 has been marked as a duplicate of this bug. ***
Comment 18 User image Håkan Waara 2008-10-22 07:26:06 PDT
Firefox (and other Gecko apps) on OS X now has auto-detection of network link and go into offline mode when you lose network connectivity. 

This bug is extremely annoying if you're developing something with a local server.
Comment 19 User image 2008-12-23 06:23:13 PST
This bug has now increased with recent upgrade to 3.0.5 using windows vista after upgrade I can't even use localhost as it is blocked in both offline and online mode. I have downloaded and installed opera but I am a FF Fanboy and don't like to have other browsers on my computer. I think you need to fix this bug asap as I have been looking at other browsers as an alternative to firefox. If I am I know other people are also. I run Apache webserver with php and mysql and use dreamweaver to develop websites. I have come to rely on Firefox as a primary web development tool and this just flat out makes me disgusted that the problem has been known about for a long time and not addressed and now it is worse.
Comment 20 User image Steve White 2008-12-26 10:04:23 PST
Problem came back in an upgrade to Ubuntu 8.10 Intrepid.
Solution (again): un-install Networkmanager (no big loss there).
Comment 21 User image Maciej Jaros 2009-01-28 06:05:18 PST
Seems resonable to have cache disabled for anything that gets translated into After all it's almost like loading a file from disk anyway.
Comment 22 User image Maciej Jaros 2009-01-28 06:11:43 PST
Just a thought, but maybe there could be something like:

(similar to network.proxy.no_proxies_on)
Comment 23 User image Honza Bambas (:mayhemer) 2009-01-28 06:37:19 PST
(In reply to comment #21)
> Seems resonable to have cache disabled for anything that gets translated into
> After all it's almost like loading a file from disk anyway.

I don't agree. If web developers want to test their cache headers on localhost server the behavior will be different from what is expected normally when address of the same configured server is not localhost.

(In reply to comment #22)
> Just a thought, but maybe there could be something like:
>  browser.cache.offline.disable_on='localhost,'
> and/or
>  browser.offline.never_offline_on='localhost,'
> (similar to network.proxy.no_proxies_on)

To fix this bug is not that simple and have option like this as well. When necko gets to offline mode DNS and socket service get shutdown. It means we cannot resolve localhost to (ipv4) or ::1 (ipv6) and even we could we cannot run any connections to it. This would mean complex rebuild of the necko infrastructure. There is workaround for this described in comment 6.
Comment 24 User image tomas.boothby 2009-04-03 09:01:31 PDT
Perhaps an intermediate solution would be to add a button to the error message -- right next to "try again".  I'm bitten by this bug every single day, since I run Sage from localhost (math software with an html interface) on my laptop, and I'm frequently on the move.
Comment 25 User image Maciej Jaros 2009-04-03 16:55:32 PDT
Checkout this extension:
After few months of testing this I can say it works-for-me :-).
Comment 26 User image Honza Bambas (:mayhemer) 2009-04-04 08:50:02 PDT
(In reply to comment #25)
> Checkout this extension:
> After few months of testing this I can say it works-for-me :-).

I don't think this fixes this bug somehow.
Comment 27 User image Jason Duell [:jduell] (needinfo me) 2009-04-06 13:55:23 PDT
Would a sensible, quick first step for this problem be to allow users to completely turn off offline mode all the time, in an about:config setting?  (I don't see one right now).   This would allow people to not have to hit "uncheck work offline" each time they fire up the browser.  

It's a blunt hammer, but it may be better than the current behavior for the small subset of users who are getting bit by this bug every day.
Comment 28 User image Jason Duell [:jduell] (needinfo me) 2009-04-06 14:32:18 PDT
Sorry, my wild mouse click set this to be a "confidential" bug.  Removing.
Comment 29 User image Mark Kaplun 2009-07-10 05:18:19 PDT
Also run into this annoying behavior :(

IMHO with HTML5 and its offline modes coming into play soon, this might be more then annoyance. Offline mode should be triggered per site when there is no connection with the site (after a request has failed) and this will solve the localhost problem as well, and the wifi stability people are complaining on
Comment 30 User image Tim (fmdeveloper) 2010-03-17 21:30:37 PDT
*** Bug 535734 has been marked as a duplicate of this bug. ***
Comment 31 User image Matt McCutchen 2010-03-26 10:04:31 PDT
*** Bug 440527 has been marked as a duplicate of this bug. ***
Comment 32 User image Matt McCutchen 2010-03-26 10:05:54 PDT
*** Bug 529861 has been marked as a duplicate of this bug. ***
Comment 33 User image Matt McCutchen 2010-03-26 10:11:20 PDT
*** Bug 539541 has been marked as a duplicate of this bug. ***
Comment 34 User image nerkn 2011-07-04 10:35:16 PDT
Work around is having a 3g stick. It's been 2 years that bug is reported but no action. Do you live in a place where everywhere covered with wifi? Don't you bother 33 bug reports.
Comment 35 User image Patrick McManus [:mcmanus] 2013-02-14 11:16:39 PST
is this a dup of 87717 (which was fixed in ff18)?
Comment 36 User image sc7898 2013-04-12 13:55:54 PDT
It would seem sensible for Firefox to see if a connection to a site is possible each and every time one is typed into the URL bar - and come out of automatic offline mode if one is. I use XAMPP to run a local wiki and a wordpress journal, and I often do so with my laptop's WiFi turned off to save energy. Firefox starts in offline mode whenever WiFi is disabled and so refuses to attempt a connection to even local sites even if I type their address into the URL bar several times. Only going onto that page and specifically pressing 'Try Again' brings it out of offline mode and allows it to access local sites.
Comment 37 User image Daniel Stenberg [:bagder] 2014-04-11 01:42:53 PDT
I believe automatically switching to offline mode is a bad idea in general and that's what's causing problems such as this.

If "offline" means don't try to resolve anything nor use any sockets, then switching on offline mode should only be done by a more active decision from a user (or script or whatever).

This is related to bug 939318
Comment 38 User image Hendy Irawan 2014-08-04 22:33:51 PDT
Created attachment 8467544 [details]

Contents of my /etc/hosts is as follows:      amidea

Firefox is NOT in Offline Mode, however with the network disconnected I'm unable to access a local site using Firefox v30. Firefox requires network connection to even browse local sites resolving to

Chrome (v35) can access the site normally as depicted in the screenshot.

Occurs in Linux Mint 17 64-bit.

Should I report a new bug? Because this happens irrespective of Work Offline checked or not. Bug 339814 seems to only cater to when Work Offline is checked.
Comment 39 User image Hendy Irawan 2014-08-06 22:40:26 PDT
I've found another bug that is exactly as my issue, which is Bug 698302 (almost similar but different than this one), reported 3 years ago (!!!).
Comment 40 User image Daniel Stenberg [:bagder] 2015-03-12 02:24:50 PDT
The problem with using "localhost" that occurs when in offline mode should be fixed with the fix from bug 1140284 (inbound just now). If someone still suffers from this problem even after using that fix, I would like to know how to repeat it!

Problems with accessing local hosts while in offline mode using _other_ hostnames than "localhost" is the problem mentioned in Bug 698302 and is not covered by this specific bug report.
Comment 41 User image Daniel Stenberg [:bagder] 2015-03-12 15:22:51 PDT
I consider this closed as well with the fix from bug 1140284.
Comment 42 User image Florian Bender 2015-07-16 13:47:26 PDT

*** This bug has been marked as a duplicate of bug 1140284 ***

Note You need to log in before you can comment on or make changes to this bug.