Quantcast
Channel: Nginx Forum
Viewing all articles
Browse latest Browse all 53287

How to check the existence of a http-only secure cookie

$
0
0
I have a http-only and secure (ssl) cookie, and I want nginx to check whether this cookie exists in a request, if not, reject it by serving a 404 page. This is just a preliminary check, so I don't care about the actual value in the cookie.

So far I've tried this: if ($http_cookie !~* "cookie_name=[.]+") { return 404; } in a location directive, but despite the cookie is contained in the requests, 404 is returned. What should be corrected here? Thanks!

Viewing all articles
Browse latest Browse all 53287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>