Welcome! Log In Create A New Profile

Advanced

Re: Dotted cookie name as proxy_cache_key problem

Maxim Dounin
March 11, 2010 09:26AM
Hello!

On Thu, Mar 11, 2010 at 08:30:12AM -0500, SergeyZh wrote:

> I've tried this already, but there's config error:
> : the closing bracket in "cookie_jetbrains" variable is missing in /usr/local/nginx/conf/nginx.conf:178
>
> Also I've tried:
> proxy_cache_key "$host$request_uri $cookie_jetbrains\.charisma\.main\.security\.PRINCIPAL";
> and with \\ and \\\ before dot, without success. :-(
> There no error, but no success too.

Ah, indeed. nginx doesn't allow anything but [A-Za-z0-9_] in
variable names, and it's basically impossible to extract cookie
with other chars in it's name via $cookie_* variables.

The only solution I see is to parse cookie header manually, e.g.
by something like this:

server {
...

proxy_cache_key "$host$request_uri $xx";

set $xx "";
if ($http_cookie ~ "(^|[;,])jetbrains\.charisma\.main\.security\.PRINCIPAL=([^;,]+)($|[;,])") {
set $xx $2;
}

...
}

Maxim Dounin

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

Dotted cookie name as proxy_cache_key problem

SergeyZh March 10, 2010 11:50AM

Re: Dotted cookie name as proxy_cache_key problem

Maxim Dounin March 11, 2010 05:08AM

Re: Dotted cookie name as proxy_cache_key problem

SergeyZh March 11, 2010 08:30AM

Re: Dotted cookie name as proxy_cache_key problem

Maxim Dounin March 11, 2010 09:26AM

Re: Dotted cookie name as proxy_cache_key problem

SergeyZh March 11, 2010 10:38AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 122
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