Add a header depending on the proxied response code with apache
I know that my answer is probably coming too late, but it can be useful to anyone wanting to set a Header in a HTTP Response based upon a condition, and more specifically upon a condition on the HTTP Status code.
You can find here an example of such a configuration (example #8) :
- Append a Caching header for responses with a HTTP status code of 200 :
Header append Cache-Control s-maxage=600 "expr=%{REQUEST_STATUS} == 200"
It can be extended to support any condition based upon Request/Response environment variables.
This example works for Apache httpd v2.4 : I suspect that it doesn't work for httpd v2.2...