Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

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.

share|improve this answer

squid 2.7 or > 3.3 will use cache-control header stale-while-revalidate and stale-if-error

header('Cache-Control: public, max-age=0, s-maxage=60, stale-while-revalidate=120, stale-if-error: 500');

would mean:

browser don't cache (to avoid double cache that can drive to strange things)

squid cache for 60s

for the next 120s deliver stale content and update cache (will mask latency of refreshing cache content)

and deliver stale content for 10min if server returns error.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.