Skip to main content

trusted_proxy_headers

Function trusted_proxy_headers 

Source
pub fn trusted_proxy_headers(config: &dyn Config) -> Vec<String>
Expand description

The TRUSTED_PROXY_HEADERS list: the header names this deployment is willing to believe the client IP from (comma-separated, e.g. TRUSTED_PROXY_HEADERS=x-forwarded-for behind one nginx, or cf-connecting-ip behind Cloudflare). Default: empty — an unconfigured deployment must not trust any forwarding header, and the runtime resolves every address from the socket peer instead.

Trust is a property of the network path, not the header: only list a header when a proxy you control overwrites it on every request. Entries are lowercased; invalid header names are ignored; forwarded (RFC 7239) is accepted as a name but its for= value format is not parsed — use an x-forwarded-for-style list or cf-connecting-ip.