![Shakeerah822](https://vmapp.org/images/player/000default.jpg)
: Why don't browsers respect cache headers for initial page request? I'm scratching my head a bit on this. A Drupal site I run is setting appropriate cache headers that should indicate that the
I'm scratching my head a bit on this. A Drupal site I run is setting appropriate cache headers that should indicate that the page can be cached for 15 minutes. However, every time I hit the page it always sends a GET request instead of loading the page from the cache.
I'm not forcefully refreshing the page each time, which I assume would indicate to the browser I want to flush the caches. I don't have any developer mode cache busting enabled.
Is this just the default behavior of browsers, or am I missing something obvious? Here's the request/response headers from hitting my homepage from FireFox dev tools:
NOTE/EDIT: Some people have suggested this was related to the Expires header being in the past. However Cache-Control overrides anything in Expires, as described in RFC 2616, Sec 14.9.3. Drupal includes this to disable caching on older HTTP 1.0 clients, which don't support the more advanced Vary header that Drupal needs for proper caching.
More posts by @Shakeerah822
3 Comments
Sorted by latest first Latest Oldest Best
In addition to the other answers, the Expires header is in the past, that is also one reason browsers won't cache the page.
You have a Vary: Cookie,Accept-Encoding header in the response. That pretty much means that if the proxy (including your browser) wanted to cache this page it should be prepared to cache a new version for every possibly modified cookie vlaue (or changs in accept-encoding). Especially, it would have to keep a record in the first place of the cookies as they where sent in the request as a distinguishing criterion. I can imagine that either the browser denies this if the cookie is too large (and hence unlikely to be repeate), or it denies it i order to avoid cookie information being leaked via the cache content, or simply the cookie content gets changed on every call.
In CMS programs some pages require interaction with the database to display the dynamic content specific to the users request. The entire page can't be cached or it wouldn't show the correct content to the user.
An example of this in practice is an eCommerce shopping cart / checkout page. Since the page looks different every time there's no way to cache it fully. Without knowing more about the specific page it's difficult to know if the page you are referencing requires database involvement.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2025 All Rights reserved.