In IIS 7.5, when I do not have output caching, my php script successfully sets browser caching to the Cache-Control header:
Cache-Control: max-age = 43200, public Content-Type: text / html
Expires: Wed, May 30, 2012 10:15:18 GMT
Server: Microsoft-IIS / 7.5
X-Powered-By: PHP / 5.4. 3
Date: Wed, May 30, 2012 10:15:18 GMT
Connection: close
Content-Length: 5105
However, if I enable output caching for .php files, I get the following header:
Cache-Control: no-cache, max-age = 43200, public Content-Type: text / html
Expires: Wed, May 30, 2012 10:25:34 GMT
Server: Microsoft-IIS / 7.5
X-Powered-By: PHP / 5.4.3
Date: Wed, May 30, 2012 10:25:34 GMT
Connection: close
(the "no-cache" notification is added to Cache-Control before my php script works)
I did not find a way to prevent the addition of "no-cache" to the Cache-Control key if output caching is enabled for the file type. I tried to do this in the web.config file:
<customHeaders>
<remove name="X-Powered-By" />
<remove name="Cache-Control" />
<add name="Cache-Control" value="public" />
</customHeaders>
This does not work. Why should it be so mutually exclusive? I would like both output caches and browser caching to be enabled.
source
share