I'm using an IIS website with a Apache HTTP reverse proxy (mod_proxy with ProxyRequests Off). I want to control the expires headers in apache (don't ask), but IIS is setting the header Expires: -1.

This causes mod_expires to ignore the request since it already has a value.

I tried the solutions in https://stackoverflow.com/questions/7930140/overwrite-cache-headers-with-mod-expires, but it doesn't work (the early trick doesn't work).

How do I disable IIS to specify Expires: -1 ?


How do I force mod_expires to override it (since I'm using apache as a reverse proxy, I should be able to do this!)

  • What version of IIS? If you have a web.config, your expires should be in there and can be deleted there or from the GUI. – generalnetworkerror May 21 '13 at 1:49
  • The question was about how to configure apache to override these -1 (the title and tags were badly chosen). The problem we had were cookies being set, so that made IIS set Expires header. We fixed that using javascript cookie istead of server side cookie. That solved it... Still no answer to how to convince mod_expires to override -1 – Jaap May 21 '13 at 22:28
  • Theoretically, Expires is just another http header. If you have the capability to delete headers in Apache, that might do the trick. – generalnetworkerror May 22 '13 at 18:27
  • See httpd.apache.org/docs/2.2/mod/mod_headers.html for "unset" to remove headers. – generalnetworkerror May 22 '13 at 18:42
  • True, but I want to override, unsetting and then setting didn't seem to work for me then, though I don't remember exactly, thanks anyway. – Jaap May 22 '13 at 21:40

mod_expires can't do that, but mod_header can. Its config is very simple:

Header set theHeader theValue
|improve this answer|||||

If you like yust to remove the Expires: -1 with mod_header you can also do:

Header unset Expires

in you proxy config.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.