Change language
English Русский
Menu
Pricing
Proxies
Solutions
Resources
FREE TOOLS
COMPAREAll comparisons

How to Use a Proxy Only for Certain Sites in Chrome

Contents
  1. Does Chrome have a per-site proxy setting?
  2. What does a PAC script do?
  3. Which ways can I give Chrome a PAC script?
  4. Can each tab use a different proxy?
  5. Why does a rule with a path fail on HTTPS sites?
  6. Which way should you choose?
  7. Quick answers

In short: Chrome on the desktop has no setting that applies a proxy to specific sites. It runs one proxy configuration for all browsing, taken from the operating system, a launch flag, an administrator’s policy or an extension. To send only some sites through a proxy, Chrome needs a PAC script, a short function that picks a proxy for each request, which you write yourself or an extension builds from rules.

To use a proxy for specific sites in Chrome, you give the browser a PAC script that names the sites, and Chrome consults it on every request. There are three places the script can come from: your operating system, a separately launched Chrome, or an extension.

Does Chrome have a per-site proxy setting?

No. Chrome’s settings page has a single proxy entry, labelled “Open your computer’s proxy settings”, and Chromium describes those settings as applying to the entire computer (Chromium’s settings strings).

Chromium’s proxy notes list four places Chrome can take its proxy configuration from: an administrator’s policy, command-line flags, an extension, and the operating system. Whichever one is in force supplies one configuration for everything the browser loads, and a per-site decision lives inside that configuration as a PAC script.

What does a PAC script do?

A PAC (proxy auto-configuration) script is a JavaScript function named FindProxyForURL. Chrome calls it for each request with the address and the host name, and uses the string it returns: DIRECT for no proxy, or PROXY host:port for a proxy server, as MDN’s PAC reference documents.

This script sends one domain and its subdomains through a proxy and everything else direct. The proxy address comes from a range reserved for documentation (RFC 5737); put your own in its place.

function FindProxyForURL(url, host) {
  if (host === "example.com" || dnsDomainIs(host, ".example.com")) {
    return "PROXY 203.0.113.10:8080";
  }
  return "DIRECT";
}

Add one condition per site you want proxied. The final return decides what happens to every site that is not listed.

Which ways can I give Chrome a PAC script?

Three: through the system proxy settings, through a separately launched Chrome, or through an extension. They differ in how much of the computer they touch and in how a change takes effect.

Through the system proxy settings

On Windows, the proxy settings have a “setup script” option that takes the script’s address, as Microsoft’s guide shows, and Chrome follows the system setting. The script has to be reachable at a URL. Every application that reads the system proxy settings will use it as well, so this suits a script you mean for the whole machine.

In a separate Chrome instance

Chrome accepts proxy flags at launch, listed on Chromium’s network settings page: --proxy-server names one proxy, --proxy-bypass-list names hosts that skip it, and --proxy-pac-url points at a script. Launched with its own --user-data-dir, the second Chrome runs next to your usual one, since two running instances cannot share a data directory (Chromium’s notes on the user data directory).

google-chrome --user-data-dir="$HOME/chrome-proxied" --proxy-server="http://203.0.113.10:8080"

That instance sends all of its traffic through the proxy, so the window you open a site in decides its route. Changing the proxy means quitting the instance and launching it again with new flags.

With a proxy extension

An extension sets Chrome’s proxy for the profile it is installed in, through the chrome.proxy API, and a switcher with rules compiles them into a PAC script. Our free ProxyJam Connector works this way, in Chrome and in Microsoft Edge:

  1. Add a profile with the proxy’s host, port and protocol.
  2. Add a rule, for example “Domain + subdomains” with example.com, pointing at that profile. The first rule that matches a site wins.
  3. Leave the fallback on Direct so that sites matching no rule connect without a proxy.
  4. Choose Auto in the toolbar popup.

For a matched site, Connector’s script names that one proxy with no direct option after it. If the proxy is down, the site fails to load and your own address is never used for it.

Can each tab use a different proxy?

Not in Chrome. The chrome.proxy API stores one value for a profile and takes no tab as a parameter, so a tab has nothing of its own to set.

The workable unit is a profile or an instance. Create a second Chrome profile for the proxied work and install the extension there, or launch a second instance with its own flags, and keep the two windows side by side. Each window then carries its own proxy.

Why does a rule with a path fail on HTTPS sites?

Chrome gives a PAC script only the scheme, host and port of an https:// address. The path, query and fragment have been stripped since Chrome 52, and the option that turned this off was removed in Chrome 75 (Chromium’s proxy notes).

A rule like example.com/shop/* therefore matches no HTTPS page. Write rules on the host name, and give a section of a site its own subdomain if it needs its own route. Plain http:// addresses still reach the script with their path, although Chromium advises against relying on that. Connector shows a warning next to any rule that depends on the path.

Which way should you choose?

For a few sites and one proxy, an extension is the least work, and the extension page lists what Connector can and cannot do on Chrome. A proxy that asks for a password is covered in why Chrome keeps asking for a proxy username and password, and moving rules over from an older switcher in what changed under Manifest V3.

If the proxy you route those sites through should keep one address registered to an internet provider, that is what an ISP proxy is. ProxyJam sells static residential (ISP) proxies on the ISP proxies page, with prices on the pricing page.

Where the routing comes from, and what each way affects

Scope comes from Chromium's documentation of where proxy settings are read and from the flags' own descriptions; the rest follows from how each method is set up. We ran no speed or reliability measurements. Wherever a PAC script decides the route, Chrome passes it an HTTPS address as scheme, host and port only.
System proxy settingsA separate Chrome instanceA proxy extension
What it affectsEvery application on the computer that reads system settingsOnly the windows of that instanceThe Chrome profile the extension is installed in
How sites are chosenBy a PAC script hosted at a URLBy which window you open a site inBy rules the extension turns into a PAC script
Changing the setupEdit the hosted scriptQuit and relaunch with new flagsEdit a rule in the extension
A proxy that needs a passwordChrome asks in a dialogChrome asks in a dialogThe extension can answer for HTTP and HTTPS proxies

Confirm which route a site took

  1. Put a check page on the list for a minute

    Add proxyjam.com to the sites your script or rules send through the proxy, next to the sites you care about.

  2. Open the check page

    What Is My IP shows the address that reached it and the internet provider and network (ASN) that address belongs to. Both should be the proxy’s.

  3. Take it off the list and reload

    The page should now show your own connection. With both readings as expected, listed sites go through the proxy and the rest go direct.

Quick answers

Does Chrome's bypass list do the same thing?

It does the reverse. The --proxy-bypass-list flag names hosts that skip the proxy, and it only takes effect together with --proxy-server, so everything not on the list goes through the proxy. To proxy a short list of sites and leave the rest direct, use a PAC script.

Do incognito windows use the same proxy?

Yes, by default. Chrome's proxy API documentation says incognito windows inherit the settings of regular windows, and an extension can set a separate value for incognito when it needs one.

Why does Chrome say it is using proxy settings from an extension?

An extension has set the proxy, and Chrome lets an extension or an administrator's policy determine the setting in place of the system one. Disable the extension, or switch it to direct, to hand control back.

What happens to sites that match no rule?

They get whatever the script returns last. In the example script that is DIRECT, so unmatched sites connect without a proxy. ProxyJam Connector calls this the fallback and sets it to Direct until you choose otherwise. Browser Extension

Sources