Skip to main content

Module proxy_protocol

Module proxy_protocol 

Source
Expand description

PROXY protocol headers, read ahead of a TCP stream.

A load balancer or TLS terminator in front of a listener opens its own connection, so the socket’s peer is the proxy rather than the client. The proxy writes one header naming the original client before any application byte, and the rest of the stream is untouched.

Both versions are accepted because proxies default to different ones: v1 is a text line (nginx stream), v2 is binary (AWS NLB, HAProxy send-proxy-v2). Only the addresses are used; v2 TLVs are skipped.

A listener that enables this should make the header mandatory. An optional header would let any client that can reach the listener directly claim any address.

Specification: https://www.haproxy.org/download/2.9/doc/proxy-protocol.txt

Enums§

HeaderError
Why a connection did not open with a usable header.

Functions§

read_header
Reads one header and returns the client it names.