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 have Apache 2.2.3 serving up (mostly) php content, and am adding headers to manage caching using mod_expires. This works well overall, but I've noticed that the value of ExpiresDefault is being used to add "Cache-Control" and "Expires" headers on responses to POST requests. In this context, the POST requests are all generating ephemeral, user-specific information which should not be getting cached anywhere.

I'm hoping that most clients will not be dumb enough to actually honor this, but I would still strongly prefer that the headers not be there in the first place. I would like to add a rule to universally omit or remove all caching headers if the request is a POST, but apply the normal rules if the request is a GET. Based on the documentation, however, it doesn't appear that mod_expires has the functionality to apply different behavior based on request type. It would theoretically be possible to base this logic on the path being requested, but due to the way the site is designed, the list of exceptions would need to be very long and I suspect that this method would be error-prone in general. Basing the headers on the request type seems like a much cleaner solution.

Is there any way to do this, or do I need to start looking for solutions outside of Apache?

share|improve this question
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.