Search code examples
httpcachingheaderhttp-headers

Why could a browser not caching a resource with Cache-Control HTTP headers?


I've read all the caching documentation for HTTP, and this are the headers for my file:

HTTP/1.0 200 OK
Server: Development/1.0
Date: Wed, 16 Jan 2013 19:29:37 GMT
Cache-Control: public, max-age=2592000
Expires: Sun, 17 Mar 2013 19:29:37
Content-Type: application/vnd.unity
Last-Modified: Sat, 17 Nov 2012 18:55:29
ETag: "1.0.0"
Content-Length: 39222189

But the browser doesn't cache the file. Each time, the request is sent and all the data transferred from scratch (200 OK instead of 304).

File size is 37.4 MB

What could be wrong?

Edit

I am now using Amazon S3 to see if it helps and still the same problem! Here go the request and the response. What am I missing? Even though the response asks for the browser to cache the file, it doesn't! I've checked the Google Chrome cache and the file is not there.

Request URL:https://s3-sa-east-1.amazonaws.com/combo-combat-release/WebPlayer.unity3d
Request Method:GET
Status Code:200 OK

**Request Headers**
GET /combo-combat-release/WebPlayer.unity3d HTTP/1.1
Host: s3-sa-east-1.amazonaws.com
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17
Accept: */*
Accept-Encoding: gzip,deflate,sdch
Accept-Language: es,en-US;q=0.8,en;q=0.6
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

**Response Headers**
HTTP/1.1 200 OK
x-amz-id-2: xu/RKgR4Xt6G3jQ1qkdO5rzd4TlngDYYERZ+bbGlalitJFMDjAgiLAoP4GXhmkeo
x-amz-request-id: 6A9389D16407D28D
Date: Wed, 16 Jan 2013 22:42:26 GMT
Cache-Control: max-age=2592000, public, must-revalidate
Last-Modified: Wed, 16 Jan 2013 22:29:55 GMT
ETag: "0f8d22257da9fcae61f21fd30b7a1fd4"
Accept-Ranges: bytes
Content-Type: application/octet-stream
Content-Length: 39222189
Server: AmazonS3

Solution

  • Try HTTP 1.1 instead of 1.0.

    http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html states:

    Note that HTTP/1.0 caches might not implement Cache-Control and might only implement Pragma: no-cache