worker_processes auto; events { worker_connections 1024; } http { map $http_x_map $map_guard { default "miss"; ~^([A-Za-z0-9._~=-]+)$ "mapped"; } server { listen 8080; server_name _; location ~ ^/preview/([A-Za-z0-9._~-]+)$ { add_header X-Preview "$1|$map_guard|$1"; return 200 "$1|$map_guard|$1"; } location = /admin { internal; return 200 "Need admin token to access"; } } }