Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

How to avoid google chrome proxy bypass for localhost?

Writer Emily Wong

On Linux I'm starting chrome as google-chrome --proxy-server=127.0.0.1:8888 --proxy-bypass-list="" however it's still not using the proxy for localhost requests.

How can I force chrome to use my proxy for localhost?

You may wonder why I wanna do this, I'm trying to record all the requests, using jmeter, to an application running on local environment.

6

4 Answers

Finally I've found a tricky solution for this. It was clear from the beginning that this is a browser issue, since I was able to make requests with curl --proxy.

The trick is that the DNS resolution also happens through the proxy, therefore on the remote machine. So just add a new entry to your remote /etc/hosts file:

127.0.0.1 local

Then you can access the remote "localhost" on your local machine, since Chrome knows nothing about this new host name. For example by: .

1
chrome.exe --proxy-server="socks5://localhost:12345" --proxy-bypass-list="<-loopback>"

this will work for localhost,127.0.0.1,127.0.0.2(have not tested, but assume),etc...

3

For Windows10, this is a System issue, that localhost will always goto current PC, and won't go through proxy.

U can set this in the OS's proxy setting to force localhost go proxy.

  • Open the OS's proxy setting
  • Ensure your proxy server(host & port) are set.
  • Below, there will be a input for you, says Use the proxy server except for address that start with the following entries. Use semicolons(;) to separate entries
  • Add <-loopback> into that input.
  • Save.

Then your request of localhost to go under proxy.

Note:

  • Though broswers will bypass localhost by default, the CMD will work even without this setting. curl -x
  • If u r using some browser extension(like SwitchyOmega), u can also add <-loopback into it's Bypass list, this still works.

refer:

If you are using mitmproxy or charles to debug localhost requests, try using Chrome 69 in macos with system proxy set.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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