Nginx proxy cache doesn't update cache-control max-age time!
themadbeaker at gmail.com
Mon Apr 6 15:26:04 UTC 2020
This was driving me crazy and I think I've figured out the problem.
I started using the proxy cache (which is great, saves regenerating a
lot of dynamic pages), except a bunch of my pages expire at a very
specific time, at the start of the hour, and my cache-control /
expires headers reflect that, because that's when the data is updated.
I started noticing stale pages shortly thereafter. Watching the
headers I realized that the 'max-age' time wasn't decreasing like it
should be, thus pages would end up being cached by clients longer than
they should be as I guess browsers consider this the most 'modern'.
Is there a setting I'm missing, or is there a way to have nginx
dynamically update the max-age while still maintaining the proxy
More information about the nginx