How to make squid send a old cache(maybe stale) to client when website is down

cachesquid

I am using squid as proxy.
But when the website is down and the cache is exceed the max time config in squid.conf,
can I just let squid send the old to client before squid revaliadate it.
If squid can do this, how to config?

Best Answer

You can use several options - refresh_pattern, max_stale, refresh_stale_hit, icp_hit_stale

If You dont need to serve stale content long time, then you can use only refresh_stale_hit option. i.e.:

refresh_stale_hit 1 minute

This allows concurrent requests while object is being refreshed to be processed as cache hits only if object expired less than 1 minute.