Redirect localhost through a proxy?

I have an HTTP proxy running on localhost: 1234. The proxy server works fine for all the web requests I make.

I have a server running on localhost: 4567. I want HTTP requests to my server to go through my proxy server. It should be simple, right? Is there a way to do IE or any other browser to do this?

+7
iis proxy localhost
source share
4 answers

As a rule, for this you can configure your browser settings. In Firefox, it's Settings → Advanced → Network → Connection (Settings).

IE automatically ignores proxies if it detects the local host URL. This has always been a spike in the side of tools such as Fiddler.

However, you can often get around this, literally http://somesite.com:1234 . Someone took the time to register the domain "somesite.com" in order to automatically switch to 127.0.0.1. This stupid IE thinks this is an external domain, but should go through your proxy server when redirecting to your local server.

Good luck.

+6
source share

Yes, there is a way!

In IE9, if you configured the proxy manually in the Internet settings, you can click "Advanced" and simply add <-loopback> to the proxy bypass list. In IE6, localhost URLs go through the proxy server when manually setting up the proxy server. Only versions of IE7 + do not send localhost requests to the proxy server.

If you want a more global solution, you can create an automatic proxy configuration script. This is basically a javascript file containing the FindProxyForURL function. You can configure Internet settings with the URL of this script. All HTTP requests will be requested by FindProxyForURL for the proxy server it needs. Therefore, if you want all the URLs to go through the proxy, you would do something like:

 function FindProxyForURL(url, host) { return "PROXY localhost:1234"; } 

If you want external addresses to go to your localhost proxy, you would do something like:

 function FindProxyForURL(url, host) { if (isPlainHostName(host)) { return "DIRECT"; } return "PROXY localhost:1234"; } 
+4
source share

On Windows:

Go to Windows / System32 / Drivers / Etc

in notepad running as administrator

Add something like this to the hosts file:

 127.0.0.1 mysite.local 

then all the data on this host in http: //mysite.local will be picked up by the proxy server.

Ubuntu: / etc / hosts

Mac: http://decoding.wordpress.com/2009/04/06/how-to-edit-the-hosts-file-in-mac-os-x-leopard/

+2
source share

It depends on your browser. In Firefox, make sure "no proxy" is empty. By default, Firefox blocks URL proxies for localhost and 127.0.0.1.

mozilla.org

-one
source share

All Articles