Skip to main content

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.
Do not use complex PAC logic without change control. A small syntax error can send users direct to the internet or break business apps.

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:
Replace SAFESQUID-IP and .internal.example.com with approved values. Avoid wildcarding public domains unless the exception has a business owner.
A single 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.
Order the list deliberately — it is the failover order, not a load-balancing hint.Appending DIRECT as a final element makes browsers bypass the proxy entirely when no node answers:
A trailing DIRECT fails open. If every SafeSquid node is unreachable, clients browse the internet unfiltered and unlogged, and nothing in the browser tells the user or the operator that enforcement stopped. Use it only where an availability requirement has been weighed against losing the control, and where the decision has a named owner. Omitting DIRECT fails closed instead: users lose web access, which is visible and reported immediately.

Host the PAC file

Host the PAC file on an approved web location. Choose a method that operations can monitor and roll back.
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.
Confirm clients can retrieve it:
Expected result: the server returns a successful response and the PAC file content is current.
Serve the file with the correct MIME type. Browsers expect application/x-ns-proxy-autoconfig. Served as text/plain or text/html, some browsers silently ignore the file and fall back to direct connections — the most common reason a correct PAC file appears to do nothing.
Verify the header before rollout:
Expected result: the response includes Content-Type: application/x-ns-proxy-autoconfig.
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 applications
  1. Settings → Network & Internet → Proxy.
  2. Turn Automatically detect settings off.
  3. Turn Use setup script on.
  4. Enter the PAC URL and select Save.
Firefox — all platforms
  1. Menu (☰) → Settings → Network Settings → Settings.
  2. Select Automatic proxy configuration URL.
  3. Enter the PAC URL and select OK.
Firefox keeps its own settings and will not pick up the Windows or macOS configuration.macOS — Safari, Chrome, and most applications
  1. System Settings → Network → select the active service → Details → Proxies.
  2. Enable Automatic Proxy Configuration.
  3. Enter the PAC URL, then select OK and Apply.
Linux desktops
For anything beyond a pilot, deliver the URL through GPO, MDM, or browser policy instead of setting it per machine — see Enterprise Deployment.

Deploy to pilot clients

  1. Configure one pilot browser with the PAC URL.
  2. Browse to an internet site that should route through SafeSquid.
  3. Browse to an internal site that should bypass SafeSquid.
  4. Inspect SafeSquid logs for the internet request.
  5. Confirm the internal request does not create unwanted proxy traffic.
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.
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.
Test PAC retrieval and browser behavior before assigning the file broadly.
Use browser proxy diagnostics 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:
Expected result: the command prints the proxy string the client would use, such as 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.
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:
  1. A DNS A record for wpad.<your-domain> points at the host serving the file.
  2. The file is served as wpad.dat, not proxy.pac. Browsers request that exact name.
  3. Clients are set to Automatically detect settings.
Verify retrieval before enabling it broadly:
Expected result: the server returns a successful response for the wpad.dat path specifically.

Verify routing decisions

On the SafeSquid server:
Expected result: proxied internet requests appear; intended internal bypasses do not.

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