How to Use a Proxy Only for Certain Sites in Chrome
Contents

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:
- Add a profile with the proxy’s host, port and protocol.
- Add a rule, for example “Domain + subdomains” with
example.com, pointing at that profile. The first rule that matches a site wins. - Leave the fallback on Direct so that sites matching no rule connect without a proxy.
- 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.
