Serving cached expired content?

ryanjwh nginx-forum at
Wed Sep 2 22:44:41 MSD 2009

Hi all, new to Nginx here and am investigating whether it can possibly replace our current configuration in production.

I've searched a bit on this but haven't come up with much:
We run a web cluster that serves files (updates) for download for our software that clients run, and the files are updated every 30-60 seconds. Our cache-control headers for certain file types are set to 5 seconds to make sure clients are always pulling the most up-to-date update.

Right now we use Apache on the front end and Squid behind Apache on the same system (this setup duplicated on many systems). This allows every incoming http request to Apache to look to Squid for the file, and squid either serves from cache or pulls from the source creating the files if the cached file is expired.

Our requirement is that due to the 5 second cache expiration settings, we need squid to continue to serve stale files if a cached file expires and the backend server isn't responding (server down, etc) so that our clients servers don't log http errors. Squid permits this via the stale-if-error directive.

Our current solution works, but wastes system resources since this means that for every connection to a web server, a corresponding 2nd connection is created (to squid). What we'd prefer to do is replace the Apache+Squid solution with Nginx, but I haven't found anything in the documentation or forums/mailing lists with any mention of if Nginx can be configured to serve stale cached content if the source is down.

Can anyone shed any light? Thanks!

Posted at Nginx Forum:,5472,5472#msg-5472

More information about the nginx mailing list