Plain hostnames or private addresses are sent to the cloud proxy
medium
A PAC file that uses an SSE cloud proxy must first return DIRECT for plain hostnames and private (RFC 1918) addresses: the cloud proxy cannot reach intranet hosts, and an agent's local-traffic exclusion does not catch a request already sent to the proxy.
Why it matters
Every vendor template puts these two exclusions at the top. Zscaler explains the failure mode: a request
for an internal host that is proxied “first goes outside your network to the Zscaler proxy but is then
blocked as it tries to access an internal host”. Netskope’s template starts with
isPlainHostName(host), Cloudflare’s templates say “No proxy for private (RFC 1918) IP addresses” and
“Bypass plain hostnames”, and Palo Alto Networks’ sample says “Bypass localhost and Private IPs”.
Endpoint agents usually exclude local traffic themselves; Skyhigh Client Proxy, for example, has “Bypass all Gateways for Local Traffic”. Such an exclusion looks at the address the connection goes to. Once the PAC file has returned the cloud proxy for an intranet host, the browser connects to the proxy’s address, so the agent never sees the intranet address and cannot bypass it. Skyhigh says that its bypass lists do not apply to requests that arrive already proxied, and that in explicit proxy mode “bypass rules are not applicable; instead, they must be configured via the PAC file”. Plain hostnames have no agent exclusion at all.
The rule fires only when the file returns the selected vendor’s cloud proxy. It stays silent when the
file points to an on-premises or other internal proxy, which can reach the intranet. It also stays
silent when the file sends only chosen hosts to the cloud proxy (each such return sits inside an if
that tests the host) and ends with return "DIRECT": intranet hosts then go direct, and an agent in
transparent mode applies its own exclusions to them. It reports two things separately: no DIRECT branch for
plain hostnames (isPlainHostName(host) or dnsDomainLevels(host) == 0), and no DIRECT branch for the
private ranges (isInNet with 10/8, 172.16/12 or 192.168/16, or a regular expression or glob on the
host string). Keep the IP-literal guard from PAC-P001 in front of isInNet, as the examples show.
Zscaler’s App Profile PAC for Tunnel with Local Proxy mode is a documented exception: there the
Forwarding Profile PAC carries the bypasses and the App Profile PAC is a single return. Traffic that a
vendor’s private-access service publishes is another one.
How to fix
Start the function with DIRECT returns for plain host names and for IP literals in 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 (isPlainHostName, isInNet), as in the good example.
Examples
Bad
function FindProxyForURL(url, host) {
if (dnsDomainIs(host, ".corp.example")) {
return "DIRECT";
}
return "PROXY ${GATEWAY}:80; PROXY ${SECONDARY_GATEWAY}:80";
}
Open bad example in checkerGood
function FindProxyForURL(url, host) {
if (isPlainHostName(host) || dnsDomainIs(host, ".corp.example")) {
return "DIRECT";
}
if (/^\d+\.\d+\.\d+\.\d+$/.test(host) &&
(isInNet(host, "10.0.0.0", "255.0.0.0") ||
isInNet(host, "172.16.0.0", "255.240.0.0") ||
isInNet(host, "192.168.0.0", "255.255.0.0"))) {
return "DIRECT";
}
return "PROXY ${GATEWAY}:80; PROXY ${SECONDARY_GATEWAY}:80";
}
Open good example in checkerRelated rules
- DNS function on the path of every request PAC-P001
- isPlainHostName alone sends every single-label name direct PAC-B006
- RFC 1918 range with the wrong mask PAC-C007
- Non-HTTP URLs reach a proxy that only accepts HTTP and HTTPS PAC-C023
References
- https://help.zscaler.com/zia/writing-pac-file
- https://docs.netskope.com/en/explicit-proxy
- https://developers.cloudflare.com/cloudflare-one/networks/resolvers-and-proxies/proxy-endpoints/best-practices/
- https://docs.paloaltonetworks.com/prisma-access/administration/prisma-access-mobile-users/mobile-users-explicit-proxy/pac-file-guidelines
- https://success.skyhighsecurity.com/Skyhigh_Client_Proxy/Manage_Client_Proxy_through_Skyhigh_SSE/Alternate_Proxy_Support_for_Explicit_Proxy_Mode