Re: Reverse proxy caching for dynamic content

2019-05-15 Thread flierps
In HTTP 1.1, the Expires header was deprecated and Cache-Control is the alternative. If both Expires and Cache-Control headers are found, Expires will be ignored. Posted at Nginx Forum: https://forum.nginx.org/read.php?2,284167,284183#msg-284183 ___ ng

Re: Reverse proxy caching for dynamic content

2019-05-15 Thread Patrick
On 2019-05-16 00:59, flierps wrote: > When max-age=0 in the Cache-Control header, Nginx will not cache, so that > will not work. > I need this in cache-control to make sure all browsers will revalidate. Don't set Cache-Control at the upstream, though. Have nginx reset it to what you need the brows

Re: Reverse proxy caching for dynamic content

2019-05-15 Thread flierps
When max-age=0 in the Cache-Control header, Nginx will not cache, so that will not work. I need this in cache-control to make sure all browsers will revalidate. So, as far as I can see I can chose between: 1. ignore cache-control header, need to set proxy_valid or nothing will be cached minimum is

Re: Reverse proxy caching for dynamic content

2019-05-15 Thread Patrick
On 2019-05-15 07:10, flierps wrote: > Yes, upstream behaves as you would expect. > > Right now Nginx proxy_valid is set to 1 second. After that second Nginx > revalidates with upstream and upstream will respond with 304 if applicable. > > I just do not want Nginx to serve from cache during that sec

Re: Reverse proxy caching for dynamic content

2019-05-15 Thread flierps
Yes, upstream behaves as you would expect. Right now Nginx proxy_valid is set to 1 second. After that second Nginx revalidates with upstream and upstream will respond with 304 if applicable. I just do not want Nginx to serve from cache during that second. It always needs to revalidate. Apache su

Re: Reverse proxy caching for dynamic content

2019-05-15 Thread Patrick
On 2019-05-15 03:57, flierps wrote: > I want to cache dynamic content, so every request needs to be revalidated. > This way when I get multiple fresh GET requests for an expensive resource, > Nginx can revalidate with the backend that only needs to generate a 304's > and the full content can be ser

Reverse proxy caching for dynamic content

2019-05-15 Thread flierps
Nginx will not cache content when max-age=0 although I believe this should be standard in combination with must-revalidate. I want to cache dynamic content, so every request needs to be revalidated. This way when I get multiple fresh GET requests for an expensive resource, Nginx can revalidate wit