Recall & Review
beginner
What is the purpose of forwarding headers in an Nginx proxy setup?
Forwarding headers allows the proxy server to pass important client information, like the original IP address and protocol, to the backend server. This helps the backend understand the real client details.
Click to reveal answer
beginner
Which Nginx directive is commonly used to forward the original client IP address to the backend?
The directive
proxy_set_header X-Real-IP $remote_addr; forwards the client's IP address to the backend server.Click to reveal answer
intermediate
What does the
X-Forwarded-For header represent in proxy forwarding?It lists the IP addresses of the client and all proxies the request passed through, helping the backend identify the original client IP even behind multiple proxies.
Click to reveal answer
beginner
How do you forward the original protocol (HTTP or HTTPS) in Nginx proxy headers?
Use
proxy_set_header X-Forwarded-Proto $scheme; to forward the protocol used by the client to the backend server.Click to reveal answer
intermediate
Why is it important to set
Host header when proxying requests in Nginx?Setting
proxy_set_header Host $host; ensures the backend server receives the original host requested by the client, which is important for virtual hosting and correct response generation.Click to reveal answer
Which directive forwards the client's IP address to the backend in Nginx?
✗ Incorrect
The directive proxy_set_header X-Real-IP $remote_addr; forwards the client's IP address to the backend server.
What does the header X-Forwarded-For contain?
✗ Incorrect
X-Forwarded-For contains the original client IP and all proxy IPs the request passed through.
How do you forward the original protocol (HTTP or HTTPS) in Nginx proxy headers?
✗ Incorrect
proxy_set_header X-Forwarded-Proto $scheme; forwards the original protocol used by the client.
Why set the Host header in proxy forwarding?
✗ Incorrect
Setting the Host header passes the original hostname requested by the client to the backend.
Which header is NOT typically forwarded by Nginx proxy to preserve client info?
✗ Incorrect
Server-Timing is not typically forwarded to preserve client info; it relates to server performance metrics.
Explain why forwarding headers like X-Real-IP and X-Forwarded-For is important in an Nginx proxy setup.
Think about how the backend knows who really made the request.
You got /4 concepts.
Describe how to configure Nginx to forward the original client IP, protocol, and host headers to the backend server.
Focus on the proxy_set_header lines needed.
You got /5 concepts.