Why not respect cache headers on new tab?

207 views
Skip to first unread message

Patrick

unread,
Aug 26, 2016, 6:05:15 AM8/26/16
to Chromium-dev
Hi,

We recently set up our website to use Etag and Last-Modified HTTP headers. Now we've noticed that Chrome's does not respect these headers when a new tab is opened. 
  • If I hit F5, click the reload icon or clicking the URL bar and hit enter to reload then Chrome sends all HTTP headers including If-Modified-Since and If-None-Match as expected which results in a 304 Not Modified response
  • However if I open a new tab and enter the same URL and hit enter Chrome does not send any headers (!Provisional Headers icon shown in inspector) and response is 200 OK (from cache). Likewise if I have an my website open then go to any URL then back to my website.
Consequently the users get a stale website, and since ours is an SPA it rather defeats the purpose of the cache headers.

Is this a bug or intended behavior and if so why? What can be done to work around it?


Josh Karlin

unread,
Aug 26, 2016, 7:29:49 AM8/26/16
to pat...@studi.se, Chromium-dev
Can you create a bug on crbug.com and put an example site on it that's broken so that we can reproduce? 

Thanks!

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Christian Biesinger

unread,
Aug 26, 2016, 9:16:58 AM8/26/16
to pat...@studi.se, chromium-dev

Guessing here, but you don't mention an Expires header or max-age parameter. If neither of those are absent the browser had to guess an expiration time. The revalidation headers such as if-none-match only matters after expiration, so it is important to send correct expiration information

If this doesn't help, yes, file a bug ad suggested by Josh.

-Christian


Charles Harrison

unread,
Aug 26, 2016, 9:26:43 AM8/26/16
to cbies...@chromium.org, pat...@studi.se, chromium-dev
Speculation: we could also be reusing resources from Blink's memory cache across tabs (if two tabs to the website are open).

---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+unsubscribe@chromium.org.

Patrick

unread,
Aug 26, 2016, 10:20:11 AM8/26/16
to Chromium-dev, pat...@studi.se
We were indeed missing another cache header. We've since added "Cache-Control: no-cache" and it works as expected now. Christians suggestion below would most likely work as well. 

Thanks for your input!

/Patrick

PhistucK

unread,
Aug 26, 2016, 3:30:39 PM8/26/16
to pat...@studi.se, Chromium-dev
Does that still trigger 304 responses in the first (reload) case?


PhistucK

PhistucK

unread,
Aug 26, 2016, 3:32:12 PM8/26/16
to pat...@studi.se, Chromium-dev
Oops, nevermind.


PhistucK
Reply all
Reply to author
Forward
0 new messages