I have a tiny nginx preview endpoint in front of an internal admin page. The preview should print the capture from the URL and also run a small map check from a request header.
It works with simple input, but the value around the map feels like it changes shape. Is this config safe to deploy?
map $http_x_map $map_guard {
default "miss";
~^([A-Za-z0-9._~=-]+)$ "mapped";
}
location ~ ^/preview/([A-Za-z0-9._~-]+)$ {
add_header X-Preview "$1|$map_guard|$1";
return 200 "$1|$map_guard|$1";
}