atom feed26 messages in ru.sysoev.nginxRe: Skipping the proxy cache based on...
FromSent OnAttachments
ehudros2Dec 29, 2010 6:14 am 
ehudros2Dec 30, 2010 5:26 am 
ehudros2Jan 2, 2011 4:28 am 
DayoJan 18, 2011 1:33 pm 
António P. P. AlmeidaJan 18, 2011 1:51 pm 
DayoJan 18, 2011 2:17 pm 
DayoJan 19, 2011 10:44 am 
DayoJan 19, 2011 10:45 am 
DayoJan 19, 2011 11:05 am 
DayoJan 19, 2011 11:06 am 
DayoJan 19, 2011 11:57 am 
António P. P. AlmeidaJan 19, 2011 12:10 pm 
DayoJan 19, 2011 12:42 pm 
António P. P. AlmeidaJan 19, 2011 1:01 pm 
DayoJan 19, 2011 1:22 pm 
EugaiaJan 19, 2011 1:26 pm 
António P. P. AlmeidaJan 19, 2011 1:27 pm 
DayoJan 19, 2011 1:48 pm 
DayoJan 19, 2011 2:19 pm 
António P. P. AlmeidaJan 19, 2011 5:20 pm 
agentzhJan 19, 2011 8:05 pm 
DayoJan 20, 2011 12:08 pm 
António P. P. AlmeidaJan 20, 2011 12:29 pm 
DayoJan 21, 2011 12:50 pm 
DayoJan 21, 2011 12:51 pm 
DayoJan 21, 2011 1:17 pm 
Subject:Re: Skipping the proxy cache based on a cookie?
From:Dayo (ngin@nginx.us)
Date:Jan 19, 2011 12:42:44 pm
List:ru.sysoev.nginx

António P. P. Almeida Wrote:

-------------------------------------------------------

On 19 Jan 2011 19h58 WET, ngin@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

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