Answer the question
In order to leave comments, you need to log in
nginx block if no cookie
Good afternoon, you need to block a specific location if there is no $cookie_NAME cookie with a numeric value.
Tried like this
set $var $cookie_NAME; location ^~ /path { if ($var) { proxy_pass http://127.0.0.1:8080; } return 403; }
curl -b "NAME=999" example.com/path/index.php
<html> <head><title>403 Forbidden</title></head> <body bgcolor="white"> <center><h1>403 Forbidden</h1></center> <hr><center>nginx</center> </body> </html>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question