How to disable automatic top level domain completion?

2

1

When I type "http://something" in the Firefox url bar and Firefox can't resolve I get automatically redirected to "http://www.something.com/".

It even does this when I never visited something.com before, so it's not the auto complete feature that causes this.

I tried setting "browser.urlbar.unifiedcomplete" to "false", but that doesn't change the behavior.

Is there any way to disable this?

I'd like to get a "DNS not found error" or something like that instead.

PS: When clicking the url to http://something in this question the error page comes up, it's only when manually typing in the url that Firefox does the automatic tld completion.

Jens Mühlenhoff

Posted 2016-03-30T12:09:12.377

Reputation: 347

Answers

0

I found the solution, it's a feature called domain guessing or "browser.fixup.alternate".

How can I disable searching and domain guessing from the Firefox Address Bar, while keeping other features?

Turning that setting to "false" turns it off, but also turns of "www." completion.

Jens Mühlenhoff

Posted 2016-03-30T12:09:12.377

Reputation: 347

I can't get this to work. I.e., I set browser.fixup.alternative.enable to false and firefox 51.0.1 still insists upon prepending www to my URL. – pgoetz – 2017-02-13T12:05:00.083

Still works here (Version 52.0b4), are you sure you're not just getting redirected by the server? – Jens Mühlenhoff – 2017-02-13T13:20:21.167

100% sure. The request is never getting to the server, which in any case does not have a host or DNS www alias. I think the problem is that the host name I'm trying to reach (a test machine on my private local network) isn't DNS resolvable (I thought /etc/hosts would suffice), in which case firefox appears to ignore the browser.fixup.alternative.enable parameter. I'm going to test this hypothesis now by making the local host resolve in DNS. Also, I'm running firefox on linux; maybe the linux version is buggy. – pgoetz – 2017-02-15T09:10:47.157

I had a problem with case sensitive DNS, the DNS server (our router) was only resolving the exact case that was entered, but I was trying to enter the DNS name in lower case. Everything was tested from a Windows Firefox. – Jens Mühlenhoff – 2017-02-15T15:40:01.683

The www. prefix or .com suffix are what the browser.fixup.alternative function usually adds though (you can see that with the other browser.fixup.alternative.* settings. – Jens Mühlenhoff – 2017-02-15T15:40:24.337

Here's the strange (still inexplicable) thing I discovered: If I use a URL involving a host which actually does not exist, firefox does not attempt to prepend www. to the URL. However, in trying to connect to an actual host which did resolve against my DNS server (hobo.mycom.com), it would always prepend www. to both the hostname and the IP address; i..e if I used 192.168.1.11 as the URL, firefox make it www.192.168.1.11 and complain that the host didn't exist. But this was only happening for a hostname which actually did exist. Guessing it has to do with the lib func for name resolution. – pgoetz – 2017-02-16T16:23:14.613

You probably already know that, but on Linux there is the host command to check if (and to what) something resolves. Aside from DNS there is also rDNS (reverse DNS resolution) to take into account. – Jens Mühlenhoff – 2017-02-16T16:46:55.357

Yes. So to be explicit. I had a webserver running on hobo.mycom.com with IP address 192.168.1.11. From my workstation I type host hobo.mycom.com and it resolves to 192.168.1.11. I then enter the URL hobo.mycom.com in firefox and hit <Enter> and it turns it into www.hobo.mycom.com and says "Server not found". The same thing happens with Chrome and firefox on Windows. I enter doesnotexist.foo.com instead it leaves it as doesnotexist.foo.com and says server not found but doesn't prepend the www. – pgoetz – 2017-02-16T16:56:48.440

"Had" because I finally got fed up and moved the machine to an independent subnet (192.168.2.0/24), put it in a different domain where I could call it www.mycom2.com, and configured the domain under my DNS server. With no modifications to anything other than the IP address, the web server now works perfectly. – pgoetz – 2017-02-16T16:58:33.117

I didn't configure the rDNS part of this, but am not sure how this would be relevant, since you're mostly looking to map hostnames to IP addresses. – pgoetz – 2017-02-16T17:02:02.903

Forgot to add that I also had to change the apache VirtualHost Servername/ServerAlias of course. – pgoetz – 2017-02-16T17:06:36.540