Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Chrome and monitoring the http connections. I load a page and the response returned by the server contains

Cache-Control: max-age=86400
Expires: Thu, 18 Jul 2013 14:51:22 GMT

Therefore, I would not expect Chrome to make a request to the server when I try to reload this page. However, when I press the Reload button, I see a new connection to the server which in turn returns the same page with a new expiration date for the cache.

Anyone has an explanation?

EDIT

Here is the request and response that I receive each time that I press the reload button (except that the time for Date, Expires and the value of CF-RAY in the response changes every time)

Request

GET /mobile_13.xml HTTP/1.1
Host    triton.karnaval.com
Cache-Control   max-age=0
Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent  Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36
Accept-Encoding gzip,deflate,sdch
Accept-Language en-US,en;q=0.8
Cookie  __cfduid=d518a34eae859853e9a8dbfb6eb4078ed1366655468

Response

HTTP/1.1 200 OK
Server: cloudflare-nginx
Date: Wed, 17 Jul 2013 14:51:20 GMT
Content-Type: text/xml
Transfer-Encoding: chunked
Connection: keep-alive
Cache-Control: max-age=86400
Expires: Thu, 18 Jul 2013 14:51:19 GMT
Vary: Accept-Encoding
CF-RAY: 8f7bfeaf5f50697
Content-Encoding: gzip

<?xml version='1.0' encoding='UTF-8'?>
...
share|improve this question
    
Can you paste a screenshot of network log? Are there any 304 not modified logs? – easwee Jul 17 '13 at 15:18
    
No, the server returns a 200 with the entire xml. I edited my question to add the detailed request and response – J_D Jul 17 '13 at 17:12

Yes, Chrome intentionally "busts the cache" by setting max-age to 0 when you click "Reload". See the source here: ResourceFetcher.cpp:676

if (isReload || frameLoadType == FrameLoadTypeSame || request.isConditional() || request.httpMethod() == "POST")
    return ReloadIgnoringCacheData;

and here: FrameLoader.cpp:1176

if (request.cachePolicy() == ReloadIgnoringCacheData) {
    if (m_loadType == FrameLoadTypeReload)
        request.setHTTPHeaderField("Cache-Control", "max-age=0");

(I think these are the right spots, I'm not super-familiar with the Chromium code.)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .