Cloudflare Gateway PAC builder

Builds a PAC file for a Cloudflare Gateway proxy endpoint with the required HTTPS directive and port 443, the identity-provider bypass Cloudflare marks as critical, and the private-network and plain-hostname bypasses of Cloudflare's template without any DNS lookup.

Cloudflare’s templates are a good base: correct RFC 1918 masks, loopback as a /8, lower-cased host, IdP bypass first. Two things are changed here. The private-network test is guarded by an IP-literal check instead of calling dnsResolve(host) for every request (one DNS dependency is qualitatively different from none), and the *.local bypass is optional because some networks still use .local as an internal DNS suffix.

One keyword and one port decide whether the endpoint answers

The pack list further down names each check. These are the reasons behind the ones that break a Cloudflare Gateway PAC file most often (source: doc, Cloudflare documentation as cited on each rule page, October 2026):

  • HTTPS, not PROXY. The proxy endpoint only accepts a TLS connection from the browser. A PROXY entry for the same host makes the browser speak plain HTTP to it, and that never connects (rule).
  • Port 443 only. Every Cloudflare example uses 443, and other ports do not answer (rule).
  • Clients without HTTPS support need another path. Safari and iOS/iPadOS cannot use an HTTPS proxy from a PAC file, so their traffic does not reach Gateway through this file (rule). On Windows, Chrome, Edge, Firefox and programs that use the Windows network libraries WinHTTP and WinINet open the TLS connection to the proxy and send their requests inside it (lab, Windows 11, October 2026). Programs built on the older .NET Framework do not, so check such tools separately.
  • Local traffic has to go direct in the file itself. Plain host names and private addresses cannot be reached through a cloud proxy, so the file sends them DIRECT before the default route, without DNS lookups (rule, DNS in PAC files).

To check an existing file against all of this, paste it into the PAC file tester and choose Cloudflare under Environment.

Not using a security service edge? The PAC file generator builds a file for your own proxies.

From the proxy endpoint you created in Cloudflare One (Networks > Resolvers and proxies > Proxy endpoints).

    Cloudflare's template marks the IdP bypass as critical for authorization endpoints.

      One per line; the domain and all its subdomains are matched.

        One per line, without a leading dot; the domain and all its subdomains are matched.

          Uses an IP-literal test in front of isInNet, so host names never trigger a DNS lookup. See isinnet-on-hostname.

            Cloudflare's template includes this. Leave it off if .local is an internal DNS suffix in your network; the checker notes it either way. See dot-local-direct.

              Generated proxy.pac

              Deploying it

              Host the file as a Cloudflare-hosted PAC (https://pac.cloudflare-gateway.com/<account-id>/<slug>, 256 KB limit) or on your own server. On your own server, send an explicit Cache-Control: max-age of a day or less. That header does not decide when Chrome, Edge or Firefox load a new version: they fetch the PAC file without their HTTP cache and load it again after a network change. It matters for other clients and for caches on the way, such as proxies and CDNs. How each client reloads the file is described in flushing the PAC cache.

              What the Cloudflare pack checks

              A Gateway proxy endpoint is a TLS-terminating proxy, so the PAC must return HTTPS <subdomain>.proxy.cloudflare-gateway.com:443; a PROXY directive to the same host fails. Chromium browsers and Firefox support HTTPS proxies through a PAC file; Safari and iOS/iPadOS do not. Cloudflare’s templates place identity-provider, private-network and streaming bypasses in the PAC because Gateway has no other place for them in this deployment model. The builder here applies one refinement on top of the published templates: it matches private ranges without any DNS lookup (it guards isInNet with an IP-literal test instead of calling dnsResolve(host)).
              • Directive: HTTPS, not PROXY; port 443. Authorization endpoints require TLS inspection and a browser that can complete the Access login.
              • Safari and iOS/iPadOS do not support the HTTPS proxy type. Windows programs that use WinHTTP or WinINet connect to an HTTPS proxy with TLS when the PAC answer names one (lab, Windows 11, 2026-10-15); older .NET Framework programs do not (lab, 2026-10-11).
              • Hosted PAC files: https://pac.cloudflare-gateway.com/<account-id>/<slug>, 256 KB per file.
              • The published templates call dnsResolve(host) for every request; the generator here keeps the same bypasses with an IP-literal guard, so hostnames never trigger a lookup.

              Sources

              Vendor documentation the pack rests on, fetched on the date shown.

              Last updated: