dnsDomainIs()

True if host ends with domain. A plain string suffix comparison, no DNS lookup.

dnsDomainIs(host, domain)  →  boolean

Because it is a plain suffix test, the domain must start with a dot: dnsDomainIs(host, "corp.example") also matches evilcorp.example. Write dnsDomainIs(host, ".corp.example") and, if the apex itself matters, add host == "corp.example".

Example

if (dnsDomainIs(host, ".corp.example") || host == "corp.example") {
  return "DIRECT";
}

Engine notes

EngineBehaviourSource
chromiumPlain suffix comparison (host.length >= domain.length && host ends with domain).code, verified 2026-10-04
services/proxy_resolver/pac_js_library.h@cb6eb0e7

Availability

Derived from each engine's vendored helper library plus its native bindings (see engines).
Functionchromium
<=51
chromium
>=52
firefox
all
pacparser
<=1.4.6
pacparser
1.5.0
pacparser
>=1.5.1
reference
all
dnsDomainIsyesyesyesyesyesyesyes

Related rules