Welcome! Log In Create A New Profile

Advanced

if-none-match with proxy_cache : properly set headers

May 30, 2013 06:41AM
Hi,
i struggled a little to get nginx to cache 304 responses from backend using proxy_cache.
What happens when configuring proxy_cache is that 304 responses are not happening because
nginx strips If-None-Match request headers. It is a workaround to prevent the client from getting
an empty response event if he did not send If-None-Match in the header.
A better workaround can be :

proxy_cache_key $http_if_none_match$scheme$proxy_host$request_uri;

So that the cache sends 304 if the header is properly set, and 200 if it isn't.
Of course one has to kill the first workaround :

proxy_set_header If-None-Match $http_if_none_match;

and cache both responses :

proxy_cache_valid 200 304 1h;

Comments welcome.
SubjectAuthorPosted

if-none-match with proxy_cache : properly set headers

kapouerMay 30, 2013 06:41AM

Re: if-none-match with proxy_cache : properly set headers

Maxim DouninMay 30, 2013 07:22AM

Re: if-none-match with proxy_cache : properly set headers

neoasceticSeptember 29, 2013 01:19AM

Re: if-none-match with proxy_cache : properly set headers

quoterJuly 16, 2014 02:14AM

Re: if-none-match with proxy_cache : properly set headers

Maxim DouninJuly 16, 2014 09:40AM

Re: if-none-match with proxy_cache : properly set headers

neoasceticSeptember 29, 2013 01:47AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 90
Record Number of Users: 5 on December 17, 2014
Record Number of Guests: 154 on December 17, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready