6

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.

1
  • yes, im developing the api. It works in the code but i want to test it in my webbrowser aswell.
    – Martin Ericson
    Aug 30, 2011 at 8:50

2 Answers 2

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.

3
  • 4
    Thanks! 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
    – Martin Ericson
    Aug 30, 2011 at 9:23
  • @Martin: Feel free to upvote and accept the answer if it helped you: stackoverflow.com/faq#howtoask
    – Wladimir Palant
    Aug 30, 2011 at 9:37
  • 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
    Nov 27, 2019 at 15:27
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.

5
  • 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
    – Martin Ericson
    Aug 30, 2011 at 8:51
  • Have you tried downloading Live HTTP Headers and seeing whether Firefox is actually requesting and getting a response from api.example.com?
    – Jez
    Aug 30, 2011 at 8:54
  • 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.
    – Martin Ericson
    Aug 30, 2011 at 9:01
  • Then it looks like Firefox can't resolve api.example.com, if that's what's being entered in the location bar.
    – Jez
    Aug 30, 2011 at 9:02
  • i enter api.example.com but its trying to resolve www.api.example.com
    – Martin Ericson
    Aug 30, 2011 at 9:06

You must log in to answer this question.