Created
February 9, 2022 18:07
-
-
Save yosida95/eb5d46c39df5909dd94bc044e4f19cd1 to your computer and use it in GitHub Desktop.
NGINX config pitfall
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http { | |
server { | |
server_name example.net; | |
listen 80; | |
types {} | |
default_type text/plain; | |
set $12 "Hello"; | |
location /ng { | |
# responds "2" instead of "Hello"! | |
# NGINX interprets '$' immediately followed by a number as the | |
# reference to regex captures regardless of following characters. | |
# https://github.com/nginx/nginx/blob/828fb94e1dbe1c433edd39147ba085c4622c99ed/src/http/ngx_http_script.c#L480-L505 | |
return 200 "$12"; | |
} | |
location /ok { | |
return 200 "${12}"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment