I have a question about the HTTP status code when Apache is acting as a caching 
reverse proxy and receives a 500 error from the backend server. I *believe* I 
have it properly configured to serve the stale content that is in the cache. 
CacheStaleOnError doc states
When the CacheStaleOnError directive is switched on, and when stale data is 
available in the cache, the cache will respond to 5xx responses from the 
backend by returning the stale data instead of the 5xx response.

Here are my logs (edited). The requests are from a load balancer monitoring the 
server.
www.host.net:80 cache hit x.x.x.8 "-" - - [13/Aug/2015:06:21:12 +0000] "GET / 
HTTP/1.1" 200 80951 "-" "-"www.host.net:80 cache hit x.x.x.8 "-" - - 
[13/Aug/2015:06:21:14 +0000] "GET / HTTP/1.1" 200 80951 "-" "-"www.host.net:80 
cache hit x.x.x.8 "-" - - [13/Aug/2015:06:21:14 +0000] "GET / HTTP/1.1" 500 
80951 "-" "-"www.host.net:80 cache hit x.x.x.8 "-" - - [13/Aug/2015:06:21:17 
+0000] "GET / HTTP/1.1" 200 80951 "-" "-"
Note the third request has a 500 response but the same content length as the 
other requests. So I think what is happening is that the stale content is being 
server with a 500 error code. This would probably be fine if a browser sees the 
content since it will display the content as an error page and be fairly 
invisible for the end user. But our load balancer is specifically looking for 
at the response code and marks the serve as down. 
Does anyone know if this is expected beahviour?

Reply via email to