flare_mlake · API · http
flare.http.proxy_protocol
PROXY protocol v1 + v2 parser (HAProxy spec).
The PROXY protocol is the de-facto wire shape for forwarding the original client TCP endpoint through a load balancer (HAProxy, AWS NLB, GCP TCP LB, Cloudflare Spectrum, ...) to the origin server. Without it the origin only sees the LB's IP — every access log, every per-IP rate limiter, every geo decision is wrong.
The protocol lives in front of the application data: the LB writes
a small header right after the TCP accept on the origin's listener,
then forwards the raw TLS / HTTP bytes unchanged. The origin sniffs
the first few bytes, parses the header, populates Request.peer
with the original client endpoint, and then proceeds with its
normal handshake / parse on the bytes that follow the header.
flare ships strict, fuzz-clean parsers for both wire shapes:
- v1 (text) —
"PROXY TCP4 src dst sport dport "(orTCP6/UNKNOWN). Variable length, terminated by CRLF, spec-mandated maximum 107 bytes. - v2 (binary) — 12-byte signature ``