Reverse proxy caching for dynamic content

flierps nginx-forum at forum.nginx.org
Wed May 15 07:57:57 UTC 2019


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 with the backend that only needs to generate a 304's
and the full content can be served to the clients.

I can get close to what I want by ignoring the header "Cache-Control:
max-age=0, public, must-revalidate" and setting proxy_cache_valid to 1s.
Unfortunately even 1s is too long for some situations.

Is there a way to cache content and mark it as stale immediately or always
revalidate on the next hit?

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,284167,284167#msg-284167



More information about the nginx mailing list