Firefox adding www when trying to resolve a domain

6

2

I'm trying to reach api.example.com, but when I do Firefox says:

Couldn't resolve server www.api.example.com

What is going on? Why is Firefox adding the www by itself?

It works fine in Chrome, Safari and even on Firefox on another computer, so there must be something wrong with my local copy.

Martin Ericson

Posted 2011-08-30T08:43:14.817

Reputation:

yes, im developing the api. It works in the code but i want to test it in my webbrowser aswell. – None – 2011-08-30T08:50:44.797

Answers

7

This feature is controlled by the three preferences browser.fixup.alternate.enabled, browser.fixup.alternate.prefix and browser.fixup.alternate.suffix that you can see if you type about:config into the location bar. By default, if Firefox cannot resolve the server name that has been typed into the location bar it will try to "fix" it. In order to do it it will try to prepend the name with the prefix "www." and/or append the suffix ".com". Chrome has a different strategy towards "fixing" incomplete names - it will simply start a Google search.

Wladimir Palant

Posted 2011-08-30T08:43:14.817

Reputation: 1 101

I also tried all the options, but the only thing that worked was: Options > Privacy & Security > tick only Cached Web Content and clear that. The issue was caused by a deployment issue that temporarily messed up the redirect structure in my web.config and it looks like Firefox cached the wrong redirect. – Savage – 2019-11-27T15:27:35.550

4Thanks! This was one part of the solution. This alone did not work, i had to clear my complete browser history in order to make it not add the "www.". Stupid feature – None – 2011-08-30T09:23:14.190

@Martin: Feel free to upvote and accept the answer if it helped you: http://stackoverflow.com/faq#howtoask

– None – 2011-08-30T09:37:38.283

1

What I believe Firefox will do is, if you type in api.example.com, look for that first. If it can't resolve it, it will then try adding the www. on the front, as so many websites (although a decreasing number) have hostnames where the www subdomain is needed to resolve their IP address.

Jez

Posted 2011-08-30T08:43:14.817

Reputation: 2 612

It works in Google Chrome and firefox on another computer. I can also ping api.example.com and get a response so firefox should be able to resolve it – None – 2011-08-30T08:51:34.050

Have you tried downloading Live HTTP Headers and seeing whether Firefox is actually requesting and getting a response from api.example.com?

– Jez – 2011-08-30T08:54:30.770

not requesting a thing. Firebug shows a GET to www.api.example.com which is aborted instantly since it cant resolve www.api.example.com cause it doesnt exist. – None – 2011-08-30T09:01:44.653

Then it looks like Firefox can't resolve api.example.com, if that's what's being entered in the location bar. – Jez – 2011-08-30T09:02:47.337

i enter api.example.com but its trying to resolve www.api.example.com – None – 2011-08-30T09:06:16.710