myIpAddress()
Returns an IP address of the machine running the PAC. Which address you get is engine-specific.
myIpAddress() → stringOn 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
| Engine | Behaviour | Source |
|---|---|---|
| chromium | Returns 127.0.0.1 when no suitable address is found. | code, verified 2026-10-04 |
| firefox | Local address of a socket connected towards the destination host (or 8.8.8.8). | code, verified 2026-10-04 |
| pacparser | Value set with setmyip(), else the resolution of gethostname(). | code, verified 2026-10-04 |
Availability
| Function | chromium | chromium | firefox | pacparser | pacparser | pacparser | reference |
|---|---|---|---|---|---|---|---|
myIpAddress | yes | yes | yes | yes | yes | yes | yes |
Related rules
- Routing decided by myIpAddress() PAC-K013