0
0
Nginxdevops~10 mins

Proxy headers forwarding in Nginx - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to forward the original client's IP address using the correct header.

Nginx
proxy_set_header [1] $remote_addr;
Drag options to blanks, or click blank then click option'
AUser-Agent
BHost
CX-Forwarded-For
DContent-Type
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Host' instead of 'X-Forwarded-For' will not forward the client IP.
Setting 'Content-Type' or 'User-Agent' headers here is unrelated.
2fill in blank
medium

Complete the code to forward the original Host header to the backend server.

Nginx
proxy_set_header [1] $host;
Drag options to blanks, or click blank then click option'
AAuthorization
BX-Forwarded-For
CReferer
DHost
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'X-Forwarded-For' here forwards the client IP, not the host.
Headers like 'Referer' or 'Authorization' are unrelated.
3fill in blank
hard

Fix the error in the code to correctly forward the original protocol (http or https).

Nginx
proxy_set_header X-Forwarded-Proto [1];
Drag options to blanks, or click blank then click option'
A$request_uri
B$scheme
C$remote_addr
D$host
Attempts:
3 left
💡 Hint
Common Mistakes
Using $host or $remote_addr will not give the protocol.
Using $request_uri is the URL path, not the protocol.
4fill in blank
hard

Fill both blanks to forward the original client IP and the original protocol correctly.

Nginx
proxy_set_header [1] $remote_addr;
proxy_set_header [2] $scheme;
Drag options to blanks, or click blank then click option'
AX-Forwarded-For
BHost
CX-Forwarded-Proto
DUser-Agent
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up Host with X-Forwarded-For.
Using User-Agent instead of protocol header.
5fill in blank
hard

Fill all three blanks to forward the original client IP, host, and protocol headers correctly.

Nginx
proxy_set_header [1] $remote_addr;
proxy_set_header [2] $host;
proxy_set_header [3] $scheme;
Drag options to blanks, or click blank then click option'
AX-Forwarded-For
BHost
CX-Forwarded-Proto
DReferer
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Referer' instead of protocol header.
Swapping Host and X-Forwarded-For headers.