0
0
Nginxdevops~10 mins

Proxy cache key 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 set the proxy cache key using the request URI.

Nginx
proxy_cache_key [1];
Drag options to blanks, or click blank then click option'
A$http_user_agent
B$host
C$request_uri
D$remote_addr
Attempts:
3 left
💡 Hint
Common Mistakes
Using $host or $remote_addr as cache key causes cache misses for different URIs.
Using $http_user_agent is unrelated to the request URI.
2fill in blank
medium

Complete the code to include the request method in the proxy cache key.

Nginx
proxy_cache_key [1]$request_uri;
Drag options to blanks, or click blank then click option'
A$request_method
B$host
C$remote_addr
D$http_cookie
Attempts:
3 left
💡 Hint
Common Mistakes
Using $host or $remote_addr does not reflect the HTTP method.
Using $http_cookie is unrelated to the request method.
3fill in blank
hard

Fix the error in the proxy cache key to include the host and URI correctly.

Nginx
proxy_cache_key [1]$request_uri;
Drag options to blanks, or click blank then click option'
A$http_user_agent
B$request_method
C$remote_addr
D$host
Attempts:
3 left
💡 Hint
Common Mistakes
Using $request_method instead of $host causes incorrect cache keys.
Using $remote_addr or $http_user_agent does not represent the host.
4fill in blank
hard

Fill both blanks to create a cache key that includes the host and the request method.

Nginx
proxy_cache_key [1][2]$request_uri;
Drag options to blanks, or click blank then click option'
A$host
B$request_method
C$remote_addr
D$http_cookie
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the order of variables can cause unexpected cache behavior.
Using $remote_addr or $http_cookie instead of host or method.
5fill in blank
hard

Fill all three blanks to create a cache key that includes the host, request method, and a custom header 'X-User'.

Nginx
proxy_cache_key [1][2][3]$request_uri;
Drag options to blanks, or click blank then click option'
A$host
B$request_method
C$http_x_user
D$remote_addr
Attempts:
3 left
💡 Hint
Common Mistakes
Using $remote_addr instead of the custom header.
Forgetting the $http_ prefix for custom headers.