Complete the code to define a map that sets $cache_bypass to 1 when $arg_nocache is present.
map $arg_nocache [1] { default 0; 1 1; }
The map directive assigns values to the variable $cache_bypass based on $arg_nocache.
Complete the map directive to set $backend to 'server1' when $http_host is 'example.com'.
map $http_host [1] {
default backend_default;
example.com server1;
}The map directive sets the variable $backend based on the value of $http_host.
Fix the error in the map directive to correctly map $request_uri to $clean_uri by removing query strings.
map $request_uri [1] {
~^(?<clean_uri>[^?]+) $clean_uri;
default $request_uri;
}The target variable must be $clean_uri to store the mapped value.
Fill both blanks to create a map that sets $is_mobile to '1' if $http_user_agent contains 'Mobile', else '0'.
map $http_user_agent [1] { ~Mobile [2]; default 0; }
The map sets $is_mobile to 1 when the user agent contains 'Mobile'.
Fill all three blanks to create a map that sets $env based on $host: 'prod' for 'example.com', 'dev' for 'dev.example.com', else 'test'.
map $host [1] { example.com [2]; dev.example.com [3]; default test; }
The map sets the variable $env to 'prod' or 'dev' based on the host, defaulting to 'test'.