Welcome! Log In Create A New Profile

Advanced

Re: Caching for a location based on cookie

Vinay Y S
January 17, 2010 11:42AM
On Fri, Jan 15, 2010 at 2:37 PM, agentzh <agentzh@gmail.com> wrote:

> On Fri, Jan 15, 2010 at 4:06 PM, Vinay Y S <vinay.ys@gmail.com> wrote:
> >
> > Hi,
> > For a given location, I want the requests to be cached only if a
> particular cookie is not present. How do I achieve that with nginx?
> > Currently I'm trying following config
> > location /album {
> > if ($cookie_logintoken ~* "") {
> > set $cache_key $scheme$proxy_host$uri$is_args$args;
> > }
>
> Please see this thread for a simple solution:
>
> http://forum.nginx.org/read.php?2,25197
>
> Hope this helps.
>

Could you please elaborate on it? There was no issues with $cache_key value
being set in if block and being visible to proxy_cache_key directive. The
issue is when the if condition is not satisfied and hence the $cache_key is
not set, I was expecting the caching to get disabled altogether as
proxy_cache_key was now being passed a uninitialized variable as parameter.

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

Caching for a location based on cookie

Vinay Y S January 15, 2010 03:14AM

Re: Caching for a location based on cookie

agentzh January 15, 2010 04:12AM

Re: Caching for a location based on cookie

Vinay Y S January 17, 2010 11:42AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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