When my PHP application returns a 301 status code, I would like to automatically add some headers to the response to prevent caching the redirect.
Header set "Expires" "Tue, 03 Jul 2001 06:00:00 GMT"
Header set "Cache-Control" "no-store, no-cache, must-revalidate, max-age=0"
Header set "Pragma" "no-cache"
While I would normally add this at the application level, because of the way this application was built, it is not a fast fix. As a stop-gap solution, I would like to configure Apache to add these headers, if possible.
How can I conditionally add these headers, based on the response status code?
Possibly related: Add a header depending on the proxied response code with apache