16.Jul.2010

Firefox Redirecting Seemingly Randomly

This is another of the “this is so obscure I couldn’t find anything on Google about it, so I’m writing the canonical post” issues.

I just had an bug that drove me batty. I was trying to access a webserver on localhost, my laptop. Firefox was redirecting to my production (ie not the laptop) server, but other browsers weren’t. Browsing to ‘localhost’ or 127.0.0.1 worked perfectly, it was just using the laptop name that caused the problem.

Straight away this rules out: the local webserver (eg .htaccess rules), dns or hosts files screw ups. I also switched OFF the local server & same issue occurred.

Of course, it took quite some time to nut my way through the above diagnostics.

Turns out it was the Firefox awesome bar being not so awesome.

Months ago, I’d redirected the laptop name (not ‘localhost’ but the actual name) to the production server via the local hosts file, to assist with a debugging issue. Of course, once I finished debugging I changed the hosts file back again.

I only recently installed a webserver on the laptop, & it seems that when I’d browsed to the laptop sufficient number of times, Firefox obviously juggled its internal preferences & then started using an older, cached version of the name->ip resolution. This added to the confusion, of course. It worked perfectly, then with no relevant changes at all suddenly started redirecting.

The solution? View history, & delete all references to the local server. Voila, incorrect ip resolution gets removed & redirection stops.

Crazy. Hopefully this saves you some time.

related

  • No Related Posts