7

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.

  • 2
    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. What are you actually trying to achieve/what does your setup look like? – Seth Jun 17 '19 at 9:29
  • 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 Jun 17 '19 at 9:43
  • "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 Jun 17 '19 at 9:49
  • 1
    What 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 Jun 17 '19 at 9:57
  • 1
    Yeah I stopped trying the proxy route and figured out how to just forward the port via ssh instead using this: serverfault.com/questions/765501/… – user628418 Jun 17 '19 at 10:53
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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.