Interview Prep/Networking/Load balancers and reverse proxies

After enabling PROXY protocol on nginx, every request fails and the log shows `broken header: "GET / HTTP/1.1"` while reading PROXY protocol.

IntermediateTroubleshootingLoad balancers and reverse proxies
Answer

Likely causes → nginx expects a PROXY protocol header (listen 80 proxy_protocol;) but the sender (LB, health checker, or you testing with curl) sends plain HTTP. Both sides must agree.

Diagnose →

aws elbv2 describe-target-group-attributes --target-group-arn <tg> \
  --query "Attributes[?Key=='proxy_protocol_v2.enabled']"
curl -v --haproxy-protocol http://127.0.0.1/   # test as if from a PROXY-enabled LB

Fix → Enable PROXY protocol v2 on the NLB target group (or send-proxy-v2 in HAProxy), or remove proxy_protocol from the listen directive. If health checks can't send it, put them on a separate listen port without PROXY protocol.

Prevent → Change the sender and receiver in the same rollout, behind a separate port first.

All Networking questions Roadmap: Networking for DevOps

More on Load balancers and reverse proxies