property IpSecurityOptions.proxyHops
Since 0.5.0

The number of proxies in front of this application, when they cannot be addressed by IP (a managed load balancer on a rotating address). The nth entry FROM THE RIGHT is the client: 1 skips the immediate peer's contribution, 2 skips two, and so on.

A header carrying fewer entries than proxyHops resolves to undefined rather than to whatever entry happens to be leftmost — a short header means the request did not traverse the expected chain, and guessing would reintroduce the spoof this option exists to close.

0 is the rightmost entry (no hop skipped). A value that is not a non-negative integer throws at middleware construction rather than silently resolving undefined on every request, which is what a negative, a fraction, or the NaN that Number() yields for an unset environment variable would otherwise do.

Mutually exclusive with IpSecurityOptions.trustedProxies.

Type

number

Usage

import { type IpSecurityOptions } from "http-security-plugin/src/index.ts";