What is the PROXY protocol and when do you need it?
AdvancedScenarioLoad Balancing, Proxies & CDN
Answer
Situation read → It carries the original client address across an L4 hop.
What I'd do →
- Enable PROXY protocol v2 on the NLB target group:
proxy_protocol_v2.enabled=true - Configure the backend to expect it: Nginx
listen 443 ssl proxy_protocol;withset_real_ip_fromandreal_ip_header proxy_protocol; - Do not enable it on one side only, because the backend then sees garbage in the first bytes and rejects with 400
- Verify with
tcpdump -Aon the first packet
Why → An L4 balancer cannot add HTTP headers, so the PROXY header is prepended to the TCP stream.
Interview tip → Say mismatched settings cause immediate protocol errors.
More on Load Balancing, Proxies & CDN
What is the difference between a Layer 4 and a Layer 7 load balancer?BeginnerWhen do you choose an ALB and when an NLB in AWS?BeginnerForward proxy versus reverse proxy: what is the difference?BeginnerHow do health checks work on a load balancer and what makes a good one?BeginnerWhat are sticky sessions and why would you avoid them?BeginnerWhat does a CDN do and when does it help?Beginner