Caching for a location based on cookie
Vinay Y S
vinay.ys at gmail.com
Sun Jan 17 19:38:04 MSK 2010
On Fri, Jan 15, 2010 at 2:37 PM, agentzh <agentzh at gmail.com> wrote:
> On Fri, Jan 15, 2010 at 4:06 PM, Vinay Y S <vinay.ys at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20100117/7270e942/attachment.html>
More information about the nginx
mailing list