Reverse proxy caching for dynamic content

Patrick 201904-nginx at
Thu May 16 03:36:25 UTC 2019

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 second. It always
> needs to revalidate.

Provided that:
a) the servers are time-synced, and
b) the upstream sets Expires to be the current time, and
c) the upstream sets Cache-Control to be 'must-revalidate'

nginx will cache the result, and handle subsequent 304s from the cache.

The nginx config is just:

        proxy_pass $upstream;
		proxy_cache STATIC;


More information about the nginx mailing list