Chrome refuses to cache the main HTML document
Reported by
rok.kr...@gmail.com,
May 28 2018
|
||
Issue description
UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.30 Safari/537.36
Steps to reproduce the problem:
1. Make your main HTML doc set header either:
a) cache-control:public; expires:(some future date)
b) cache-control:public,max-age=123456
c) cache-control:public,max-age=123456,immutable
2. Load the page the first time.
3. Load the page the second time.
SO question: https://stackoverflow.com/questions/50482573/chrome-refuses-to-cache-the-main-html
What is the expected behavior?
The request for the HTML doc is not made. Works with other browsers.
What went wrong?
The request for the HTML doc is made.
Did this work before? N/A
Does this work in other browsers? N/A
Chrome version: 63.0.3239.30 Channel: n/a
OS Version:
Flash Version:
I think caching the main page is the most efficient way to reduce the TTI (time to interactive) and CP (contentful paint) metrics, as it reduces one whole roadtrip to the server. Web performance is heavy on those two metrics right now.
,
Jun 6 2018
Looks like this is working as intended. I'm adding a few folks who might know better, but basically what is happening is that when a user hits the same URL in the URL bar we just treat it as a reload, and thus using net::LOAD_VALIDATE_CACHE.
However we do use cache if the user loads different page and then loads the document again, or loads the document in another tab.
The corresponding code lives in navigation_request.cc:
void UpdateLoadFlagsWithCacheFlags(
int* load_flags,
FrameMsg_Navigate_Type::Value navigation_type,
bool is_post) {
switch (navigation_type) {
case FrameMsg_Navigate_Type::RELOAD:
case FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL:
*load_flags |= net::LOAD_VALIDATE_CACHE;
We also have the same logic in Blink (which is unused today), where this browser-side code is copied from (I believe).
|
||
►
Sign in to add a comment |
||
Comment 1 by yhirano@chromium.org
, May 28 2018Components: -Blink>Network Blink>Loader
Status: Untriaged (was: Unconfirmed)