Re: Disable NGINX caching 304 Responses from Origin Server

2017-07-26 Thread Ryan Barclay
Hi Peter, When we used this: proxy_set_header If-Modified-Since $http_if_modified_since ...Nginx was caching 304 responses from the upstream when the client requested If-Modified-Since (if it was the first request for that object). Future requests by clients that didn't set the If-Modified-

Re: Disable NGINX caching 304 Responses from Origin Server

2017-07-26 Thread Peter Booth
Ryan, Just to be pedantic, can you spell out exactly what you meant when you said "and deliver future responses as 304 to clients even without the If-Modified-Since header?" What requests were triggering the 304 response? Were you observing what a browser was seeing or were you using curl or wg

Re: Disable NGINX caching 304 Responses from Origin Server

2017-07-26 Thread Ryan Barclay
So this config seems to work: proxy_cache_valid 200 3M; proxy_cache_valid 304 0; proxy_cache_valid 404 0; proxy_cache_revalidate on; proxy_ignore_headers Cache-Control Expires; There is no need for: proxy_set_header If-Modified-Since $http_if_modified_since; On 26/07/2017 09:57, Ryan Barcla

Re: Disable NGINX caching 304 Responses from Origin Server

2017-07-26 Thread Ryan Barclay
Thanks for the reply Peter. I've noticed something interesting and wondered if you could shed some light on it. Simply adding: proxy_ignore_headers Cache-Control Expires; Enables 304 responses from the origin server without setting: proxy_set_header If-Modified-Since $http_if_modified_since

Re: Disable NGINX caching 304 Responses from Origin Server

2017-07-26 Thread Peter Booth
I can’t see an obvious issue, but I can say that there is no such thing as a simple web server setup where caching is involved. I have gray hairs that appeared after working with a high traffic retail website that had seven levels of caching (browser cache, CDN, hardware load balancer, nginx reve

Re: Disable NGINX caching 304 Responses from Origin Server

2017-07-26 Thread Ryan Barclay
The following config seems to work for the situation I discussed: proxy_cache_valid 200 3M; proxy_cache_valid 304 0; proxy_cache_revalidate on; proxy_set_header If-Modified-Since $http_if_modified_since; proxy_ignore_headers Cache-Control Expires; ... can anybody see any problems with this conf

Re: Disable NGINX caching 304 Responses from Origin Server

2017-07-25 Thread Ryan Barclay
That's an interesting solution. Would nginx still cache our other items as normal using this config? We specify cache settings via Cache-Control and Expires headers sent from the origin server. Also, we are using X-Accel-Expires for some pages which are sent from the origin server too. This

Re: Disable NGINX caching 304 Responses from Origin Server

2017-07-24 Thread Zhang Chao
Hi! Have you used the proxy_cache_valid ? Maybe you can add this directive to disable the 304 cache explicitly. proxy_cache_valid 304 0; On 24 July 2017 at 23:20:35, Ryan Barclay (r...@rbftpnetworks.com) wrote: We ha

Disable NGINX caching 304 Responses from Origin Server

2017-07-24 Thread Ryan Barclay
We have a pretty simple setup with NGINX sitting on the front and a backend server (on a separate physical server) that provides the content. Nginx then caches content based on the EXPIRES and Cache-Control headers set by the origin server. We noticed that NGINX was not issuing 304 headers to