Welcome! Log In Create A New Profile

Advanced

Re: proxy_cache_bypass and proxy_no_cache

December 10, 2012 06:24AM
On Dec 10, 2012, at 14:15 , amodpandey wrote:

> Thank you :) This one worked.
>
> I would like to take this opportunity to share the exact problem I had.
>
> I am using sticky module for some app version targetting. Plus I have
> enabled proxy cache. The sticky module works in a way that it first let the
> upstream handle the weights and according to which server catered the
> response it set cookie with server info hash. So the response that is cached
> is without cookie.
>
> So in this case even proxy_no_store $http_set_cookie does not work. So the
> only way I could think was to change the caching behaviour to cache only
> requests with my cookie.
>
> There is only proxy_no_store ( proxy_store does something else ) so I need
> to negate the value, if set. Here the map helped me to achieve the same.
>
> But I wish there could have been a straight forward way.
>
> I had this followup question
>
> Why we need to have proxy_cache_bypass and proxy_no_cache else
> nginx: [warn] "proxy_no_cache" functionality has been changed in 0.8.46, now
> it should be used together with "proxy_cache_bypass"

By default nginx does not cache response with Set-Cookies header. So to
force to cache such response you should set:
proxy_ignore_headers Set-Cookie;

As to your problem, it's better to resolve it on upstream side by setting
X-Accel-Expires: 0
for the first response without Cookie, and
X-Accel-Expires: a_number_of_seconds_to_cache
for response with cookies.

Also you should $http_cookie_cache variable to
proxy_cache_key


--
Igor Sysoev

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

proxy_cache_bypass and proxy_no_cache

amodpandey December 10, 2012 02:19AM

Re: proxy_cache_bypass and proxy_no_cache

António P. P. Almeida December 10, 2012 03:32AM

Re: proxy_cache_bypass and proxy_no_cache

amodpandey December 10, 2012 04:02AM

Re: proxy_cache_bypass and proxy_no_cache

Antonio P.P. Almeida December 10, 2012 04:28AM

Re: proxy_cache_bypass and proxy_no_cache

amodpandey December 10, 2012 04:31AM

Re: proxy_cache_bypass and proxy_no_cache

amodpandey December 10, 2012 05:15AM

Re: proxy_cache_bypass and proxy_no_cache

amodpandey December 10, 2012 05:22AM

Re: proxy_cache_bypass and proxy_no_cache

Igor Sysoev December 10, 2012 06:24AM

Re: proxy_cache_bypass and proxy_no_cache

Igor Sysoev December 10, 2012 06:26AM

Re: proxy_cache_bypass and proxy_no_cache

António P. P. Almeida December 10, 2012 03:56AM

Re: proxy_cache_bypass and proxy_no_cache

Antonio P.P. Almeida December 10, 2012 09:10AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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