0

stale-while-revalidate and stale-if-error are not working together in Squid 2.7 as seen here:

http://www.igvita.com/2009/08/05/masking-latency-failures-with-squid/

The squid is running with the next conf:

http_port 80 accel defaultsite=mydomain.com
cache_peer 127.0.0.1 parent 8000 0 no-query originserver name=main
httpd_suppress_version_string on
header_access Cache-Control deny all
cache_effective_user squid
negative_ttl 5 seconds

And in the backend php+apache server at port 8000 I return this:

<?php

// trigger_error("Throw error 500", E_USER_ERROR");

header('Cache-Control: max-age=10, stale-while-revalidate=20 stale-if-error=20');
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

sleep(2);

die("OK");

When I uncomment the trigger_error if I send the stale-while-revalidate then client gets the error, if I send this next one the stale-if-error works as expected:

<?php

trigger_error("Throw error 500", E_USER_ERROR");

header('Cache-Control: max-age=10, stale-if-error=20');
// Next one don't works
// header('Cache-Control: max-age=10, stale-while-revalidate=20 stale-if-error=20');
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

sleep(2);

die("OK");

1 Answer 1

1

That's a bug appeared after squid-2.7-stable7 (this inclusive). I added the bug at squid bugzilla at the next link:

http://bugs.squid-cache.org/show_bug.cgi?id=3671

squid-2.7-stable6 works as expected.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .