Path, port or query characters in a host pattern
medium
host contains no slash, colon, question mark, space or port. A host pattern with any of these can never match.
Why it matters
Hostnames consist of letters, digits, hyphens and dots (IP literals of digits and dots).
shExpMatch(host, "www.corp.example/app"), "intranet.corp.example:8080" or a pattern with a
trailing space is always false. The rule the author wanted silently does not exist. Port
and path decisions must be made on url, and even there with care (PAC-X008).
How to fix
Strip the path/port from the host pattern, or move the check to url with a pattern anchored at scheme and path.
Examples
Bad
function FindProxyForURL(url, host) {
if (shExpMatch(host, "intranet.corp.example:8080")) {
return "DIRECT";
}
return "PROXY proxy.corp.example:8080";
}
Open bad example in checkerGood
function FindProxyForURL(url, host) {
if (host == "intranet.corp.example") {
return "DIRECT";
}
return "PROXY proxy.corp.example:8080";
}
Open good example in checkerRelated rules
- URL scheme in a host pattern PAC-C002
- Wildcard characters in dnsDomainIs or localHostOrDomainIs PAC-C004
- Port matched as a substring of the URL PAC-X008