Welcome! Log In Create A New Profile

Advanced

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

Francis Daly
February 20, 2013 05:24PM
On Wed, Feb 20, 2013 at 05:10:26PM -0500, mrtn wrote:
> 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!

Does it pass if the cookie value starts with a dot?

Every character in the regex means something. "." probably doesn't mean
what you think it means here.

Omit the [] and it might work for you. Or you could just test
$cookie_cookie_name directly -- does it equal the empty string? If not,
it has a value.

(This doesn't actually check for http-only or secure, but you probably
know that already.)

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

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

mrtn February 20, 2013 05:10PM

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

Francis Daly February 20, 2013 05:24PM

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

mrtn February 21, 2013 08:27AM

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

Valentin V. Bartenev February 21, 2013 08:42AM

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

kalpesh.patel@glgroup.com March 11, 2013 05:54PM

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

Valentin V. Bartenev March 12, 2013 03:02AM

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

kalpesh.patel@glgroup.com March 12, 2013 01:38PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 230
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready