myIpAddress()

Returns an IP address of the machine running the PAC. Which address you get is engine-specific.

myIpAddress()  →  string

On machines with several interfaces, VPN clients or IPv6, the address returned is often not the one you expect, so location-based routing with myIpAddress() is fragile. Prefer separate PAC URLs per location or a proxy-side decision.

Example

if (isInNet(myIpAddress(), "10.20.0.0", "255.255.0.0")) {
  return "PROXY proxy-site2.corp.example:8080";
}

Engine notes

EngineBehaviourSource
chromiumReturns 127.0.0.1 when no suitable address is found.code, verified 2026-10-04
services/proxy_resolver/proxy_resolver_v8.cc
firefoxLocal address of a socket connected towards the destination host (or 8.8.8.8).code, verified 2026-10-04
netwerk/base/ProxyAutoConfig.cpp@3f73c528 MyIPAddress()
pacparserValue set with setmyip(), else the resolution of gethostname().code, verified 2026-10-04
src/pacparser.c@v1.5.3 my_ip()

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
myIpAddressyesyesyesyesyesyesyes

Related rules