How do I remove localhost from proxy exceptions in Firefox?

7

1

According to this, localhost is not forwarded to the proxy by default: http://kb.mozillazine.org/Network.proxy.no_proxies_on

My question is: How do I remove localhost as an exception?

The "No proxy for" field in my proxy options in firefox is already empty, but localhost is not being forwarded to the proxy.

network.proxy.no_proxies_on in about:config is also already empty.


My particular scenario that I'm trying to get to work:

I have two Windows 10 machines: Proxy server A and client B

Server A is is running bitvise ssh server. Client B connecting to it as a socks 5 proxy via Putty. The server A has a local web server running on the localhost:9001 that I want to access in Firefox from the client B.

user628418

Posted 2019-06-17T08:24:07.967

Reputation: 171

2It doesn't make sense to forward localhost (127.0.0.1) to a proxy because you wouldn't be able to access that content. What are you actually trying to achieve/what does your setup look like? – Seth – 2019-06-17T09:29:12.490

I have two Windows 10 machines. One is running bitvise ssh server. The other is connecting to it as a socks proxy via Putty. The proxy server machine has a local webservice that I want to access from the client. – user628418 – 2019-06-17T09:43:55.347

"It doesn't make sense to forward localhost (127.0.0.1) to a proxy because you wouldn't be able to access that content" Why? – user628418 – 2019-06-17T09:49:07.700

1What happens if you have a local service running and your proxy settings are being used? Lot's of programs do it and all of a sudden, depending on your proxy configuration, they wouldn't be able to access that service anymore. Which is why it's so common to exclude localhost. That said, how did you check that the request isn't being forwarded? Why are you not using a reverse proxy on Machine A or just expose the service to a regular interface on A? – Seth – 2019-06-17T09:57:46.180

1

Yeah I stopped trying the proxy route and figured out how to just forward the port via ssh instead using this: https://serverfault.com/questions/765501/converting-ssh-command-to-a-putty-command

– user628418 – 2019-06-17T10:53:21.087

@Seth it does make sense, if you want all other requests to be served from the other end of the proxy it isn't a stretch to have ::1 be the same. For normal local services you'd just use a client not using the proxy. I (and I'm guessing the other 4 upvotes for answers below) have a service hosted on localhost on the other end of an ssh tunnel, and it should not be accessible on any other interface/hostname. I'm tunneling into this machine and am pushing SOCKS back. This recent change to firefox is why the question is asked, mozilla recently broke/protected against legit remote localhost – Hashbrown – 2019-09-16T03:16:51.020

IMO a VPN would still be preferable. See RFC 2606 & 6761 (localhost should always resolve to loopback), 5735 (what loopback is). While you can make it work it's simply a odd setup that's not recommended. Other setups could include creating a virtual network interface that's not routed, filtering requests through a reverse proxy and there are probably a couple of dozen more that would be more in line with standard, expected network behavior. – Seth – 2019-09-16T05:35:02.823

Answers

9

You have to change an additional setting in addition to removing localhost and 127.0.0.1 from the No Proxy For box. Set network.proxy.allow_hijacking_localhost to true in about:config.

This was changed recently. Source: https://bugzilla.mozilla.org/show_bug.cgi?id=1535581

Connor

Posted 2019-06-17T08:24:07.967

Reputation: 191

3

I had the same problem in my Arquillian-Tests.

I simply changed this Preference:

network.proxy.allow_hijacking_localhost", true

my Code:

FirefoxOptions options = new FirefoxOptions();
options.setProxy(seleniumProxy);
options.addPreference("network.proxy.allow_hijacking_localhost", true);
WebDriver driver = new FirefoxDriver(geckoservice, options);

(geckoservice is needed for Firefox 48 and above see https://www.seleniumhq.org/docs/04_webdriver_advanced.jsp )

Edit: I use Firefox Developer Version 69.

CursedJuggernaut

Posted 2019-06-17T08:24:07.967

Reputation: 31