0
0
Nginxdevops~10 mins

proxy_pass directive 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 requests to the backend server.

Nginx
location /api/ {
    proxy_pass [1];
}
Drag options to blanks, or click blank then click option'
Alisten 8080
Broot /var/www/html
Cserver_name backend
Dhttp://backend:8080
Attempts:
3 left
💡 Hint
Common Mistakes
Using directives like listen or server_name instead of a URL.
Omitting the protocol (http://) in the URL.
2fill in blank
medium

Complete the code to forward requests to HTTPS backend.

Nginx
location /secure/ {
    proxy_pass [1];
}
Drag options to blanks, or click blank then click option'
Aftp://backend:443
Bhttp://backend:443
Chttps://backend:443
Dbackend:443
Attempts:
3 left
💡 Hint
Common Mistakes
Using http:// instead of https:// for secure backend.
Leaving out the protocol entirely.
3fill in blank
hard

Fix the error in the proxy_pass directive to correctly forward to backend.

Nginx
location /app/ {
    proxy_pass [1];
}
Drag options to blanks, or click blank then click option'
Ahttp://backend/app/
Bhttp://backend/
Cbackend/app
Dhttp://backend/app
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the trailing slash causes incorrect URI forwarding.
Using relative paths without protocol.
4fill in blank
hard

Fill both blanks to forward requests and set the Host header correctly.

Nginx
location /service/ {
    proxy_pass [1];
    proxy_set_header Host [2];
}
Drag options to blanks, or click blank then click option'
Ahttp://backend:9000
B$host
Cbackend
Dhttps://backend:9000
Attempts:
3 left
💡 Hint
Common Mistakes
Using https:// without backend support.
Setting Host header to a fixed string instead of $host.
5fill in blank
hard

Fill all three blanks to forward requests, set Host header, and disable SSL verification.

Nginx
location /api/ {
    proxy_pass [1];
    proxy_set_header Host [2];
    proxy_ssl_verify [3];
}
Drag options to blanks, or click blank then click option'
Ahttps://backend:8443
B$host
Coff
Don
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to disable SSL verification when backend uses self-signed cert.
Setting Host header to a fixed string instead of $host.