Recall & Review
beginner
What is the purpose of proxy headers in nginx?
Proxy headers in nginx pass important client information to the backend server, such as the original IP address and protocol, so the backend knows who made the request.
Click to reveal answer
beginner
Which nginx directive sets the original client IP address in proxy headers?
The directive
proxy_set_header X-Real-IP $remote_addr; sets the original client IP address in the X-Real-IP header.Click to reveal answer
intermediate
What does the
X-Forwarded-For header represent?The
X-Forwarded-For header lists the IP addresses of the client and any proxies the request passed through, helping the backend identify the original client IP.Click to reveal answer
intermediate
How do you pass the original protocol (HTTP or HTTPS) to the backend in nginx proxy headers?
Use
proxy_set_header X-Forwarded-Proto $scheme; to send the original protocol (http or https) to the backend server.Click to reveal answer
beginner
Why is it important to set proxy headers correctly in nginx?
Setting proxy headers correctly ensures the backend server receives accurate client info, which is vital for logging, security checks, and generating correct responses.
Click to reveal answer
Which nginx directive sets the client's original IP address in proxy headers?
✗ Incorrect
The directive
proxy_set_header X-Real-IP $remote_addr; sets the original client IP address in the header.What does the
X-Forwarded-Proto header tell the backend?✗ Incorrect
The
X-Forwarded-Proto header tells the backend if the original request was HTTP or HTTPS.Why is the
X-Forwarded-For header useful?✗ Incorrect
The
X-Forwarded-For header lists the client and proxy IP addresses for tracking the original client.Which of these is NOT a typical proxy header set by nginx?
✗ Incorrect
X-Server-Name is not a standard proxy header set by nginx.What happens if proxy headers are not set correctly in nginx?
✗ Incorrect
Without correct proxy headers, the backend server may not know the real client IP or protocol.
Explain why proxy headers like X-Real-IP and X-Forwarded-For are important in nginx proxy setups.
Think about how the backend knows who made the request.
You got /3 concepts.
Describe how to configure nginx to pass the original protocol and client IP to the backend server.
Look for directives that set headers with $remote_addr and $scheme.
You got /2 concepts.