Welcome! Log In Create A New Profile

Advanced

Re: Help: cache or not by cookie

July 09, 2009 10:26AM
On Thu, Jul 09, 2009 at 06:05:26AM -0400, nfn wrote:

> Thanks Igor, but how do I validate if the user is guest. I only want to show the cached version to guests.

You need to use
proxy_cache_key "http://cacheserver$request_uri $cookie_user";
proxy_cache_valid 6m;

Then in your backend you should test the "user" cookie. If it is not equal
to "guest", then you should add the "X-Accel-Redirect: 0" header in a
response. In this case nginx will not cache the response. Otherwise,
if cookie is equal to "guest" you do not need to set the header or may set
"X-Accel-Redirect: 360" to say nginx to cache the response to 6 min.


--
Igor Sysoev
http://sysoev.ru/en/
Subject Author Posted

Help: cache or not by cookie

tonyy June 20, 2009 06:54AM

Re: Help: cache or not by cookie

Igor Sysoev June 20, 2009 09:24AM

Re: Help: cache or not by cookie

Igor Sysoev June 22, 2009 07:32AM

Re: Help: cache or not by cookie

tonyy June 20, 2009 10:04AM

Re: Help: cache or not by cookie

tonyy June 22, 2009 09:53AM

Re: Help: cache or not by cookie

nfn July 08, 2009 06:40PM

Re: Help: cache or not by cookie

Igor Sysoev July 09, 2009 03:05AM

Re: Help: cache or not by cookie

nfn July 09, 2009 06:05AM

Re: Help: cache or not by cookie

Igor Sysoev July 09, 2009 10:26AM

Re: Help: cache or not by cookie

ned0r September 03, 2009 06:53PM

Re: Help: cache or not by cookie

Igor Sysoev September 04, 2009 06:10AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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