Route Browsers With PAC
A Proxy Auto-Configuration (PAC) file gives managed browsers a repeatable routing decision. Use it when explicit proxy testing has passed and you need controlled exceptions for internal sites, cloud services, or pilot groups.Use this method when
Use PAC when:- Browser routing needs centralized logic.
- Internal destinations must bypass SafeSquid.
- Different networks need different proxy decisions.
- Rollout will later be managed through GPO, MDM, or browser policy.
Validate prerequisites
Confirm:- Explicit proxy pilot passed.
- PAC hosting location is approved and highly available.
- Browsers can retrieve the PAC URL.
- Internal bypass list is reviewed.
- Rollback method is documented.
Create a controlled PAC file
Use exact internal bypasses and a default SafeSquid proxy route:SAFESQUID-IP and .internal.example.com with approved values. Avoid wildcarding public domains unless the exception has a business owner.
Add proxy failover
Add proxy failover
A single Order the list deliberately — it is the failover order, not a load-balancing hint.Appending
PROXY return means every browser loses web access when that node is unavailable. The return value accepts an ordered, semicolon-separated list; the browser tries each in turn and moves on when one does not answer.DIRECT as a final element makes browsers bypass the proxy entirely when no node answers:Host the PAC file
Host the PAC file on an approved web location. Choose a method that operations can monitor and roll back.- Internal Web Server
- Cloud Storage or CDN
- Endpoint Management
Host
proxy.pac on a highly available internal HTTP or HTTPS service. Use this when all managed endpoints can reach the internal network before browsing.Point clients at the PAC URL
Point clients at the PAC URL
Hosting the file does nothing until clients are told where it is. Disable auto-detection at the same time, or WPAD discovery may override the URL you set.Windows — Chrome, Edge, and most applicationsFor anything beyond a pilot, deliver the URL through GPO, MDM, or browser policy instead of setting it per machine — see Enterprise Deployment.
- Settings → Network & Internet → Proxy.
- Turn Automatically detect settings off.
- Turn Use setup script on.
- Enter the PAC URL and select Save.
- Menu (☰) → Settings → Network Settings → Settings.
- Select Automatic proxy configuration URL.
- Enter the PAC URL and select OK.
- System Settings → Network → select the active service → Details → Proxies.
- Enable Automatic Proxy Configuration.
- Enter the PAC URL, then select OK and Apply.
Deploy to pilot clients
- Configure one pilot browser with the PAC URL.
- Browse to an internet site that should route through SafeSquid.
- Browse to an internal site that should bypass SafeSquid.
- Inspect SafeSquid logs for the internet request.
- Confirm the internal request does not create unwanted proxy traffic.
Common PAC functions
Common PAC functions
Use simple PAC functions first. Keep logic short enough for operations to review during incidents.Avoid broad
DIRECT matches for public domains unless the exception has a business owner and review date.PAC function reference
PAC function reference
Every function below is available inside
FindProxyForURL(url, host).isInNet and isResolvable force DNS lookups on every evaluation. Prefer dnsDomainIs and shExpMatch in hot paths, and keep DNS-dependent tests below the cheap string tests.Time-based and day-based routing belongs in SafeSquid Time Profiles, not in the PAC file. A PAC rule is enforced by the client and can be bypassed; a SafeSquid profile cannot.Debug PAC behavior
Debug PAC behavior
Test PAC retrieval and browser behavior before assigning the file broadly.Use browser proxy diagnostics such as Expected result: the command prints the proxy string the client would use, such as
chrome://net-export or Firefox about:networking only on approved pilot endpoints. Store the export with the change record if it proves a routing defect.Test routing decisions offline, before any endpoint receives the file. pactester evaluates FindProxyForURL without a browser:PROXY SAFESQUID-IP:8080 or DIRECT.pactester ships in the pacparser package. On other distributions, search for pacparser or pactester.Run one test per routing rule you added, including at least one destination that must go DIRECT. Save the output with the change record as proof the file was validated before rollout.A PAC file is JavaScript, so a syntax error breaks proxy selection for every rule, not only the faulty one. The common causes are a missing semicolon, bracket, or quote; a misspelled function name; and a file served with the wrong MIME type or from an unreachable URL.Plan WPAD carefully
Plan WPAD carefully
Web Proxy Auto-Discovery (WPAD) can reduce manual configuration, but it expands the trust boundary to DNS and DHCP discovery. Use WPAD only when DNS, DHCP, and endpoint teams approve ownership, spoofing controls, and rollback.Required evidence includes the WPAD DNS or DHCP record, PAC file checksum, pilot endpoint result, and rollback record.If WPAD is approved, three conditions must all hold or discovery silently fails:Expected result: the server returns a successful response for the
-
A DNS A record for
wpad.<your-domain>points at the host serving the file. -
The file is served as
wpad.dat, notproxy.pac. Browsers request that exact name. - Clients are set to Automatically detect settings.
wpad.dat path specifically.Verify routing decisions
On the SafeSquid server:Capture rollout evidence
Store:- PAC file URL.
- PAC file version or checksum.
- Approved bypass entries.
- Pilot browser and user.
- Positive proxy log sample.
- Internal bypass test result.
- Rollback method.
Troubleshoot PAC rollout
Next steps
- Enterprise Deployment - deploy PAC through endpoint management.
- System-Wide Proxy Settings - test host-level routing.
- Application-Specific Configuration - handle tools that ignore browser PAC.

