<LINK rel=SUBRESOURCE href=“file”> doesn't cache, despite having correct cache headers. Appears to download twice with a 200OK response

StackOverflow https://stackoverflow.com//questions/24000590

Question

I use Glyphicons on my website, they are served as a part of Bootstrap 3. In viewing the Network tab of the dev console I realized they were loading late (when the browser's parser got to it), and there was room to improve performance by bringing that element to the browser sooner.

In Chrome it is possible to do this via:

<link rel="subresource" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/fonts/glyphicons-halflings-regular.woff">

In the <HEAD> of the document.

I am seeing the DOMContentLoaded time increase in a way which suggests this file is loading twice (first on line 5 in the screenshot, and again on the 2nd to last line). My suspicion is further confirmed that it is loading twice by the HTTP Response Code (200) which tells me it came from the remote server both times, and was not fetched from Cache.

You can see what the dev console looks like here: http://oi60.tinypic.com/2t9n7.jpg (In case tinypic goes down, here it is in my dropbox: https://www.dropbox.com/s/vlwgywatg9rsg8v/subresourcenotcached.png)

The Cache Headers on the HTTP version of that asset are, but it's worth noting the network tab output on the dev console looks the same for both HTTP and HTTPS.

HTTP/1.1·200·OK(CR)(LF)
Server:·cloudflare-nginx(CR)(LF)
Date:·Mon,·02·Jun·2014·17:49:06·GMT(CR)(LF)
Content-Type:·application/octet-stream(CR)(LF)
Content-Length:·23320(CR)(LF)
Connection:·close(CR)(LF)
Last-Modified:·Thu,·13·Feb·2014·22:45:07·GMT(CR)(LF)
Expires:·Sat,·23·May·2015·17:49:06·GMT(CR)(LF)
Cache-Control:·public,·max-age=30672000(CR)(LF)
Access-Control-Allow-Origin:·*(CR)(LF)
CF-Cache-Status:·HIT(CR)(LF)
Accept-Ranges:·bytes(CR)(LF)
CF-RAY:·13457c53f04d0378-LAX(CR)(LF)
(CR)(LF)

Does anybody have insight into how I can get this .woff file to cache, and properly utilize the LINK SUBRESOURCE capability in Chrome?

Was it helpful?

Solution

It's a bug in the current Chrome. Have a look at https://code.google.com/p/chromium/issues/detail?id=312327

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top