lighttpd/lighttpd1.4 — pull request #3 by russor (2014-06-10 03:00:20+00:00)
Title: support proxy-protocol on listening sockets

Support for the proxy-protocol http://haproxy.1wt.eu/download/1.5/doc/proxy-protocol.txt

This is tested (applied to 1.4.35) on FreeBSD. Basically lets us put our lighttpds behind a proxy without losing the client IP.

if proxy.expect_header is set in socket context, the header is read and processed; if proxy.expect_header & 2; then the schema is set to https (proxy is doing TLS termination, but lighttpd needs to know)

There's a small memory cost to have the additional state, so I put it all in ifdefs, with a configure option.