# Wildcard characters in dnsDomainIs or localHostOrDomainIs

Source: https://findproxyforurl.net/rules/dnsdomainis-with-glob/ · last updated 2026-10-04

Rule PAC-C004 (`dnsdomainis-with-glob`), severity medium, category: Correctness.

dnsDomainIs and localHostOrDomainIs compare strings literally. "*.corp.example" is looked for as the literal characters *.corp.example, which no hostname contains.

## Why it matters

Only `shExpMatch` understands `*` and `?`. `dnsDomainIs(host, "*.corp.example")` asks whether
`host` ends with the eight characters `*.corp.example`; DNS names cannot contain `*`, so the
answer is always no. The branch is dead and traffic goes to the default route. The
confusion comes from mixing the two functions' syntaxes.


## How to fix

Use dnsDomainIs(host, ".corp.example") (plain suffix) or shExpMatch(host, "*.corp.example") (glob).

## Bad

```js
function FindProxyForURL(url, host) {
  if (dnsDomainIs(host, "*.corp.example")) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
```

## Good

```js
function FindProxyForURL(url, host) {
  if (dnsDomainIs(host, ".corp.example")) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
```

## Engine behaviour

- chromium: dnsDomainIs is a plain suffix comparison in the helper library. (source: code, verified 2026-10-04)
