This file contains hidden or 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
server { | |
... | |
location ~ ^/api/product/check_availability/.+ { | |
# The key zone to use for cache lookups. | |
# http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache | |
proxy_cache availability; | |
# http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ignore_headers |
This file contains hidden or 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
map $variable_to_check $variable_to_set { | |
"check_if_variable_matches_me" "variable_matches_checked_value"; | |
default "no_match"; | |
} |
This file contains hidden or 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
if [ "$variable_to_check" == "check_if_variable_matches_me" ]; then | |
variable_to_set="variable_matches_checked_value" | |
else | |
variable_to_set="no_match" | |
fi |
This file contains hidden or 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
case $variable_to_check in: | |
check_if_variable_matches_me) | |
variable_to_set="variable_matches_checked_value" | |
;; | |
*) | |
variable_to_set="no_match" | |
;; | |
esac |
This file contains hidden or 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
map $thing $useful_variable { | |
"thing_matches_me" "thing_matched_1"; | |
"nope_thing_matches_me" "thing_matched_2"; | |
default "no_match"; | |
} |
This file contains hidden or 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
if ($thing1 = $thing2) { | |
return 301 "{'Error': 'Things don't match!'}"; | |
} |
This file contains hidden or 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
# if delimeter between two variables is ':' | |
map $thing1:$thing2 $do_things_match { | |
"~^([^:]+):\1$" 1; | |
default 0; | |
} |
This file contains hidden or 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
map $request_uri $uri_only { | |
"~^(?<u>[^\?]+)\?(?:.*)?" $u; | |
default $request_uri; | |
} | |
map $uri_only $shun_if_client_is_a_baddy { | |
"~\/\/" 1; | |
"~*%2f" 1; | |
default 0; | |
} |
This file contains hidden or 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
if ($shun_if_client_is_a_baddy = 1) { | |
return 403 'You shall not pass!!!'; | |
} |
This file contains hidden or 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
map $arg_FOO:$http_x_bar $shun_mismatched_payload { | |
"~^([^:]+):\1$" 1; | |
default 0; | |
} |