I have a website which maintenance I've inherited, which is a big hairy mess.
One of the things I'm doing is improving performance. Among other things, I'm adding Expires
headers to images.
Now, there are some images that are served through a PHP file, and I notice that they do have the Expires
header, but they also get loaded every time.
Looking at Response Headers, I see this:
Expires Wed, 15 Jun 2011 18:11:55 GMT Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma no-cache
Which obviously explains the problem.
Now, I've looked all over the code base, and it doesn't say "pragma" anywhere. .htaccess doesn't seem to have anything related either.
Any ideas what could be setting those "pragma" (and "cache-control") headers, and how can I avoid it?
"The Pragma: no-cache header field is an HTTP/1.0 header intended for use in requests. It is a means for the browser to tell the server and any intermediate caches that it wants a fresh version of the resource, not for the server to tell the browser not to cache the resource.
The Pragma HTTP/1.0 general header is an implementation-specific header that may have various effects along the request-response chain. This header serves for backwards compatibility with the HTTP/1.0 caches that do not have a Cache-Control HTTP/1.1 header.
The 'Cache-control' HTTP header holds instructions for caching in both requests and responses. Because the 'Pragma' header is used for backwards compatibility with HTTP/1.0 where the 'Cache-control' header is not yet presented. If sensitive information in application responses is stored in the local cache.
no-cache. The no-cache response directive indicates that the response can be stored in caches, but the response must be validated with the origin server before each reuse, even when the cache is disconnected from the origin server.
The culprit may be php.ini, where session.cache_limiter=nocache. Change the value to blank or public to avoid the anti-cacheing headers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With