Interview Prep/Networking/Load balancers and reverse proxies

After moving TLS termination to the load balancer, the browser shows `ERR_TOO_MANY_REDIRECTS`.

BeginnerTroubleshootingLoad balancers and reverse proxies
Answer

Likely causes → The LB now talks HTTP to the app. The app sees a plain-HTTP request and redirects to HTTPS; the browser follows, the LB forwards it again as HTTP, and the loop repeats.

Diagnose →

curl -sIL https://app.example.com/ | grep -iE '^(HTTP|location)'

Fix → Make the app trust X-Forwarded-Proto from the LB (Django SECURE_PROXY_SSL_HEADER, Express app.set('trust proxy', 1), Spring server.forward-headers-strategy=native), or do the HTTP→HTTPS redirect on the LB (ALB listener rule on port 80) and remove it from the app. In nginx behind an LB: proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;.

Prevent → Decide which single layer owns the HTTPS redirect and document it.

All Networking questions Roadmap: Networking for DevOps

More on Load balancers and reverse proxies