Challenge 1: The Three Forwarding Headers — Solution Walkthrough The configuration: proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $host; Why each line works: X-Forwarded-For uses $proxy_add_x_forwarded_for specifically (not $remote_addr alone) so that if the request already passed through another proxy earlier, the current client's IP is appended to the existing chain rather than overwriting it. X-Forwarded-Proto uses $scheme, Nginx's own variable holding whether the original request was http or https. X-Forwarded-Host uses $host, preserving the original Host header the client actually requested, in case Nginx's own internal request to the backend uses a different hostname. WHY THIS WORKS AS AN ANSWER ------------------------------ This exercise is a direct, hands-on application of all three of this chapter's own header examples together, correctly using $proxy_add_x_forwarded_for rather than a plain IP variable for the first header, which is exactly the detail that matters once more than one proxy hop is involved.