Challenge 3: A Nested Location Block Losing Its Parent's Headers — Solution Walkthrough What actually happens: Per this chapter's own warning box, because the location /api/ {} block sets its own proxy_set_header (for X-Api-Version), it stops inheriting every proxy_set_header from the parent server {} block entirely — not just the headers it doesn't mention. Both X-Forwarded-For and X-Forwarded-Proto silently disappear from any request handled by /api/, even though neither was ever explicitly removed or overridden — they're simply no longer inherited once this location block has any proxy_set_header of its own. Why this is easy to miss: There's no error, warning, or visible sign that this happened — the config still looks correct on a casual read, since X-Forwarded-For and X-Forwarded-Proto are never mentioned or contradicted anywhere inside the /api/ block. The only way to notice the problem is knowing about this specific Nginx inheritance behavior in advance, or discovering it after the fact when the backend behind /api/ starts misbehaving in ways that trace back to missing forwarded headers. The fix: Explicitly repeat every header still needed inside the /api/ block itself: location /api/ { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Api-Version "2"; proxy_pass http://backend_pool; } WHY THIS WORKS AS AN ANSWER ------------------------------ This exercise directly applies this chapter's own warning box to a concrete two-block config, correctly identifying that ALL parent headers are lost, not just the newly added one, and that the fix is explicit repetition rather than assuming partial inheritance still applies.