Skipping the proxy cache based on a cookie?
Dayo
nginx-forum at nginx.us
Wed Jan 19 23:43:14 MSK 2011
António P. P. Almeida Wrote:
-------------------------------------------------------
> On 19 Jan 2011 19h58 WET, nginx-forum at nginx.us
> wrote:
>
> > I think I am getting closer and hope someone can
> nudge me across the
> > line.
> >
> > My set up is now ...
> >
> >
> > if ($http_cookie !~* "mycookie=0") {
> > add_header Cookie: "mycookie=1";
> > }
> >
>
> IIRC you *want* to bust the proxy cache. Right?
> So,
> http://wiki.nginx.org/HttpProxyModule#proxy_no_cac
> he
>
> If you want a header do as describe, this if you
> don't want to cache
> the response. If not use a cache busting variable,
> to force a refresh.
>
> --- appa
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
Hi
Thanks for the stopping by.
i am already using proxy_cache_bypass and proxy_no_cache.
What I am trying to do is as follows
1. User requests page and Nginx checks for cookie and if not present,
sets cookie value to 1. Default cookie value is 0.
2. Cookie is evaluated against proxy_cache_bypass and proxy_no_cache so
that if value is 1, user gets passed to backend and response is not
cached
3. Backend checks for cookie and if value is 1, sets value to 0 and
serves specific additional content
4. User requests another page and this time cookie is present with 0
value so Step 1 is skipped
5. Cookie is evaluated against proxy_cache_bypass and proxy_no_cache and
since value is 0, user gets served from cache or if cache is stale, from
backend
6. If user is passed to backend, backend checks for cookie and since
value is 0, serves normal content
I have Steps 2 onwards basically setup but Step 1 is where it is falling
down. I can't get Nginx to set that cookie.
Thanks again
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,161969,167684#msg-167684
More information about the nginx
mailing list