6

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 ?

OR

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!)

Jaap
  • 367
  • 3
  • 16
  • 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 01: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 http://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

2 Answers2

0

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

Header set theHeader theValue
peterh
  • 4,953
  • 13
  • 30
  • 44
0

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

Header unset Expires

in you proxy config.

Radon8472
  • 185
  • 8