<div dir="ltr"><div style>I have a slow backend application that I'm using nginx to provide the authentication and caching for. It's been working great however there is one nagging issue that I cannot seem to resolve, when the backend app sets a s-maxage and a maxage Cache-Control, nginx only seems to honor the maxage and expires the cache with its value.</div>
<div style><br></div><div style>An example response from the backend is like this...</div><div style>

<p class="">Cache-Control: max-age=60,<span class=""> </span>s-maxage=3600,<span class=""> </span>public,<span class=""> </span>must-revalidate</p></div><div style>My idea here is I only want the client to cache this data for a short amount of time before checking in with me it see if it's still valid. The data usually wont be changing that often so I want nginx to cache it for an hour, but in the event it does I use the excellent nginx-cache-purge script in my backend app to invalidate the cache and the next time a client checks in (after 60 seconds) they will get the new data.</div>
<div style><br></div><div style>However in all my testing and usage I will only get a cache HIT for 60 seconds after the first request to a resource, after 60 seconds it will be EXPIRED then it will go to the backend again. Am I missing something in the Cache-Control that is causing this behavior?</div>
<div style><br></div><div style><br></div><div><br></div><div>--</div><div><br></div>Ryan Parrish<br></div>