How to force browsers to use proxy server for specific domains such as google.com or facebook.com

9

3

I know IE allows you to force all connections through a proxy server, except specific domains or local addresses. But is there a way to let IE to reach Internet directly, and only force connections to specific websites through proxy?

Use case is if google.com or facebook.com are blocked and I want to force connections to these sites through a VPN connection to a proxy server hosted somewhere else, while direct access to Internet for everything else.

user4641581

Posted 2015-05-18T15:57:35.283

Reputation: 101

Is using Firefox an option for you? – Daniel B – 2015-05-18T16:00:39.340

@DanielB ideally I'd like to be browser agnostic. I know there are solutions for Firefox such as one listed here but I haven't found one for IE.

– user4641581 – 2015-05-18T16:03:17.790

By default Chrome uses the exact same proxy settings that IE uses. So the same steps you would use to configure IE to ignore/use the proxy will work for Chrome. – Ramhound – 2015-05-18T16:08:24.770

1I would wager you can use a configurable local proxy, something like Privoxy, set that as your browser's full-time proxy, but then have it only pass certain requests through a second, external proxy. – Arthur Kay – 2015-05-18T17:02:52.433

@Ramhound The problem is IE only permits me to specify specific sites to be not going through a proxy server, and everything else to go through a proxy server. I only need to have 2 sites to go through the proxy server and I don't think IE supports this hence asking this question here. If you know there is a way to configure what I need can you please let me know how? – user4641581 – 2015-05-19T13:07:33.103

@ArthurKay Thanks this is interesting. However this means I'll need to setup Privoxy on each PC (I don't want to add a PC to the LAN just to run Privoxy in server mode), and then a separate proxy server somewhere on the other end of the VPN tunnel. Is there anyway we can do this simpler? – user4641581 – 2015-05-19T13:09:16.263

@user4641581 Trying to figure the reason I thought you were using Chrome. – Ramhound – 2015-05-19T13:39:40.690

Answers

3

A generic solution to this problem is to use a custom proxy auto-configuration (PAC) file. In this file you can have arbitrary logic to select the proxy - including a white list of domains.

Here is how to do it:

  • Create a text file anywhere in your local file system, e.g. C:\ProxyAutoConfiguration.js
  • Paste the following content into that file

    function FindProxyForURL(url, host) {
    
        // use proxy for specific domains
        if (shExpMatch(host, "*.google.com|*.facebook.com"))
            return "PROXY yourproxy:8080";
    
        // by default use no proxy
        return "DIRECT";
    }
    
  • Configure the file URL of this file (e.g. file:///C:/ProxyAutoConfiguration.js) as proxy auto-configuration script in your system or browser. In IE, this configuration is here: Internet Options > Connections > LAN settings > Use automatic configuration script.

For more information on the proxy auto-configuration file format, see for example this web page: https://findproxyforurl.com/example-pac-file/

oberlies

Posted 2015-05-18T15:57:35.283

Reputation: 430

Windows 10 doesn't seem to work with this at all. I gave up in the end, Windows is such a pain. – Ken Sharp – 2019-12-21T11:15:13.193

0

I think I found a solution. There is a ton of proxy tools for Windows on Codeplex! This way I don't have to setup something like Privoxy, which appears to be a bit overkill and harder to configure. https://www.codeplex.com/site/search?query=proxy&ac=4

user4641581

Posted 2015-05-18T15:57:35.283

Reputation: 101

-1

You can do that using a chrome extension. Download and install Browsec and then in the settings go to smart settings and then turn on proxy for your choice websites. Here you can read in full details. Set Proxy for a specific website domains

Zahid Ali

Posted 2015-05-18T15:57:35.283

Reputation: 5

Please read how to recommend software in answers, particularly the bits in bold; then edit your answer to follow the guidelines there. Thanks!

– bertieb – 2018-11-11T13:02:28.343

One site then you have to pay a subscription. Basically spam. – Ken Sharp – 2019-12-21T11:13:38.607