Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does Browser still sends request for cache-control public with max-age?
    primarykey
    data
    text
    <p>I have Amazon S3 objects, and for each object, I have set</p> <pre><code>Cache-Control: public, max-age=3600000 </code></pre> <p>That is roughly 41 days.</p> <p>And I have Amazon CloudFront Distribution set with Minimum TTL also with 3600000.</p> <p>This is the first request after clearing cache.</p> <pre><code>GET /1.0.8/web-atoms.js HTTP/1.1 Host: d3bhjcyci8s9i2.cloudfront.net Connection: keep-alive Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 </code></pre> <p>And Response is</p> <pre><code>HTTP/1.1 200 OK Content-Type: application/x-javascript Content-Length: 226802 Connection: keep-alive Date: Wed, 28 Aug 2013 10:37:38 GMT Cache-Control: public, max-age=3600000 Last-Modified: Wed, 28 Aug 2013 10:36:42 GMT ETag: "124752e0d85461a16e76fbdef2e84fb9" Accept-Ranges: bytes Server: AmazonS3 Age: 342557 Via: 1.0 6eb330235ca3971f6142a5f789cbc988.cloudfront.net (CloudFront) X-Cache: Hit from cloudfront X-Amz-Cf-Id: 92Q2uDA4KizhPk4TludKpwP6Q6uEaKRV0ls9P_TIr11c8GQpTuSfhw== </code></pre> <p>Even while Amazon clearly sends Cache-Control, Chrome still makes second request instead of reading it from Cache.</p> <pre><code>GET /1.0.8/web-atoms.js HTTP/1.1 Host: d3bhjcyci8s9i2.cloudfront.net Connection: keep-alive Cache-Control: max-age=0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 If-None-Match: "124752e0d85461a16e76fbdef2e84fb9" If-Modified-Since: Wed, 28 Aug 2013 10:36:42 GMT </code></pre> <p><strong>Question:</strong> Why does chrome makes second request? </p> <p><strong>Expires</strong> This behavior changes when I put an explicit Expires attribute in headers. Browser will not send subsequent request for Expires header, but for cache-control public, it does send it. My all S3 objects will never change, they are immutable, when we change file, we put them as new object with new URL.</p> <p><strong>In Page Script Reference</strong> Chrome makes subsequent requests only sometimes, I did this test by actually typing URL in browser. When script is referenced by HTML page, for few subsequent requests chrome loads cached scripts, but once again after sometime, once in a while it does send request to server. There is no Disk Size issue here, Chrome has sufficient cache space.</p> <p>Problem is we get charged for every request, and I want S3 objects to be cached forever, and should be loaded from Cache and should never connect to server back.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload