Proxy.pac ignored on Windows 11: why the setup script has no effect

Published · updated

On Windows a PAC file can be set correctly and still be ignored by some programs, by services or on VPN. Windows has more than one proxy setting, and its PAC engine answers some calls differently from the browsers. This page goes through the causes from the setting to the script.

The usual causes at a glance

What you seeLikely causeCheck or fix
Browsers use the PAC file, services and background programs do notThey use the separate WinHTTP settingnetsh winhttp show advproxy
The PAC file is ignored only on VPNThe VPN connection has its own proxy settingsNetwork & internet > VPN > Advanced options
Error 12167The PAC file cannot be downloadedOpen the script address; it must answer with status 200
Error 12166The script fails, often because of ?. or ??The tester with the profile “Windows WinHTTP”
Error 12180Automatic detection finds no PAC URLWPAD not working
Rules for office hours never applydateRange() and timeRange() are always false on WindowsDo not route by date or time for Windows programs
Some host names miss every ruleWindows services pass the host as typedhost = host.toLowerCase(); at the start

A PAC file (proxy auto-configuration file, often proxy.pac or wpad.dat) is a small JavaScript program that decides for every request which proxy to use. On Windows 11 there are three places where it can go wrong: the program reads another setting, the file cannot be loaded or run, or the file runs but Windows answers some calls differently from the browsers.

Windows has more than one proxy setting

The user setting. In Settings > Network & internet > Proxy, the PAC file is set under Use setup script: select Set up and enter the script address (source: doc, Microsoft Support, checked 2026-10-12). Browsers and most desktop programs of the signed-in user follow this setting. If Automatically detect settings is also on, it is tried first, and a PAC file found through WPAD replaces your setup script. The page on automatic proxy detection shows which setting wins when several are on.

The WinHTTP setting. Windows services, the background download service BITS and many programs that run without a user use WinHTTP, one of the two network libraries of Windows. Its proxy setting is separate, so a PAC file that is set only in the user setting is not used by such services. netsh winhttp show advproxy shows it; the page PAC file not applied by Group Policy or Intune shows how to give WinHTTP a PAC URL.

VPN connections have their own proxy settings. A proxy set for the network does not apply to a VPN connection; it is set separately under Network & internet > VPN, the connection’s Advanced options, Proxy settings for this VPN connection (source: doc, Microsoft Support, as above). If the PAC file is ignored only on VPN, look there.

A company policy may set it for you. In a managed company, group policy or device management usually sets the proxy. A setting you change by hand may be overwritten at the next policy update.

The file cannot be downloaded: error 12167

Programs that use WinHTTP report ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT (12167) when the PAC file cannot be downloaded, and ERROR_WINHTTP_AUTODETECTION_FAILED (12180) when automatic detection finds no PAC URL. ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR (12178) means that a proxy for the address could not be found (source: doc, Microsoft WinHTTP error messages, checked 2026-10-11). Open the script address from the affected machine and check that it answers with status 200 and the file (PAC-D010). A PAC file on a file path or a share works for some Windows programs but not in Chrome and Edge (PAC-D009). For automatic detection, see WPAD not working.

The file loads but fails: error 12166

ERROR_WINHTTP_BAD_AUTO_PROXY_SCRIPT (12166) means that the script failed. On Windows the most common reason is newer JavaScript: optional chaining (a?.b), the ?? operator and object spread are syntax errors there, and then the file fails for every address, while Chrome runs it without complaint (PAC-K020). console.log() also throws on Windows, because console is not defined (source: lab, Windows 11 25H2, 2026-10-11; PAC-K022). Paste the file into the tester, choose the profile “Windows WinHTTP” and press Check.

The file runs, but some rules never match on Windows

Windows runs the PAC file in its own engine, which answers some calls differently from the browsers: for example, dateRange() and timeRange() are always false, and some programs pass the host name in upper case. The article Windows runs PAC files differently from Chrome and Firefox lists every difference and what to do about it.

A change does not take effect

Windows typically keeps the PAC URL and the script until the computer’s IP address changes, and the browsers keep their own copy. Restart the program you test with after each change; the page Reset the PAC cache shows how to make each engine load the file again. For browsers on Windows, see PAC file not working in Chrome or Edge; all other symptoms are sorted on the page PAC file troubleshooting.

Frequently asked questions

Why is my proxy.pac ignored on Windows 11?

Usually because the program reads another proxy setting than the one you changed. Settings > Network & internet > Proxy is a per-user setting for browsers and desktop programs. Windows services and many background programs use the WinHTTP setting, which netsh winhttp show advproxy displays. A VPN connection has its own proxy settings too.

Where do I set a PAC file in Windows 11?

In Settings > Network & internet > Proxy, under Use setup script, select Set up and enter the script address. For a VPN connection, set it under Network & internet > VPN, Advanced options, Proxy settings for this VPN connection.

What do WinHTTP errors 12166, 12167 and 12180 mean?

12167 means the PAC file could not be downloaded, 12166 means it was downloaded but its script failed, and 12180 means automatic detection found no PAC URL.