Complete the code to set a custom header in the response.
add_header X-Custom-Header [1];The add_header directive requires the header value to be quoted as a string.
Complete the code to rewrite the request URI to /newpath.
rewrite ^[1] /newpath break;
The rewrite directive uses a regular expression, so the pattern must start with ^ and end with $ to match exactly.
Fix the error in the proxy_set_header directive to forward the original Host header.
proxy_set_header Host [1];The variable $host holds the original Host header value and must be prefixed with $ to be interpreted correctly.
Fill both blanks to set a response header only if the status is 404.
if ($status [1] 404) { add_header X-Error [2]; }
!= instead of == reverses the condition.The if condition checks if the status equals 404 using ==. The header value should be a quoted string.
Fill all three blanks to create a map that transforms status codes to messages.
map $status $message {
200 [1];
404 [2];
default [3];
}The map directive assigns messages to status codes. Each message must be a quoted string.