The original website isn't caching html, css, or images the way I think it should. The results from google chrome har for just a single image while requesting different pages on the website are below. It is part of a larger browsing of a website trying to figure out why the browser thinks it should be cached but the browser is re-requested from server. I removed all har not specificially related to this image.
I don't have any cache-killer or cache-disabler on. I even went to relatively clean computer to make sure there weren't any dev tools installed that might mess with the cache.
All the request/response headers from the first request appear to imply that the 2nd and 3rd requests should not make re-requests but come from browser local cache.
What am I missing?
{
"startedDateTime": "2017-02-10T21:21:44.273Z",
"time": 56.46199999999624,
"request": {
"method": "GET",
"url": "http://616206ee2c1b2155fd11-21abbde6fa52e03b7fd037b3488bb991.r53.cf1.rackcdn.com/images/default-source/site-cdn/LoginLogo.png",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Accept",
"value": "image/webp,image/*,*/*;q=0.8"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Accept-Encoding",
"value": "gzip, deflate, sdch"
},
{
"name": "Referer",
"value": "http://authentrip.com/"
},
{
"name": "Host",
"value": "616206ee2c1b2155fd11-21abbde6fa52e03b7fd037b3488bb991.r53.cf1.rackcdn.com"
},
{
"name": "Accept-Language",
"value": "en-US,en;q=0.8"
},
{
"name": "User-Agent",
"value": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36"
}
],
"queryString": [],
"cookies": [],
"headersSize": 428,
"bodySize": 0
},
"response": {
"status": 200,
"statusText": "OK",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Date",
"value": "Fri, 10 Feb 2017 21:21:44 GMT"
},
{
"name": "Origin",
"value": "https://mycloud.rackspace.com"
},
{
"name": "Last-Modified",
"value": "Fri, 09 Dec 2016 05:10:48 GMT"
},
{
"name": "ETag",
"value": "ab904584a8e355da2fd0437065839e10"
},
{
"name": "Content-Type",
"value": "image/png"
},
{
"name": "X-Timestamp",
"value": "1481260247.52133"
},
{
"name": "Cache-Control",
"value": "public, max-age=349"
},
{
"name": "Content-Length",
"value": "6397"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Accept-Ranges",
"value": "bytes"
},
{
"name": "X-Trans-Id",
"value": "txbeec00752b6a4e1e9e3b5-00589e2ca4dfw1"
},
{
"name": "Expires",
"value": "Fri, 10 Feb 2017 21:27:33 GMT"
}
],
"cookies": [],
"content": {
"size": 6397,
"mimeType": "image/png",
"compression": 0
},
"redirectURL": "",
"headersSize": 433,
"bodySize": 6397,
"_transferSize": 6830
},
"cache": {},
"timings": {
"blocked": 0.396999999992431,
"dns": -1,
"connect": -1,
"send": 0.13800000000685503,
"wait": 23.861999999994016,
"receive": 32.06500000000294,
"ssl": -1
},
"serverIPAddress": "204.2.145.184",
"connection": "989",
"pageref": "page_1"
},
{
"startedDateTime": "2017-02-10T21:22:48.357Z",
"time": 0,
"request": {
"method": "GET",
"url": "http://616206ee2c1b2155fd11-21abbde6fa52e03b7fd037b3488bb991.r53.cf1.rackcdn.com/images/default-source/site-cdn/LoginLogo.png",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Accept",
"value": "image/webp,image/*,*/*;q=0.8"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Accept-Encoding",
"value": "gzip, deflate, sdch"
},
{
"name": "Referer",
"value": "http://authentrip.com/"
},
{
"name": "Host",
"value": "616206ee2c1b2155fd11-21abbde6fa52e03b7fd037b3488bb991.r53.cf1.rackcdn.com"
},
{
"name": "Accept-Language",
"value": "en-US,en;q=0.8"
},
{
"name": "User-Agent",
"value": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36"
}
],
"queryString": [],
"cookies": [],
"headersSize": 428,
"bodySize": 0
},
"response": {
"status": 200,
"statusText": "OK",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Date",
"value": "Fri, 10 Feb 2017 21:21:44 GMT"
},
{
"name": "Origin",
"value": "https://mycloud.rackspace.com"
},
{
"name": "Last-Modified",
"value": "Fri, 09 Dec 2016 05:10:48 GMT"
},
{
"name": "ETag",
"value": "ab904584a8e355da2fd0437065839e10"
},
{
"name": "Content-Type",
"value": "image/png"
},
{
"name": "X-Timestamp",
"value": "1481260247.52133"
},
{
"name": "Cache-Control",
"value": "public, max-age=349"
},
{
"name": "Content-Length",
"value": "6397"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Accept-Ranges",
"value": "bytes"
},
{
"name": "X-Trans-Id",
"value": "txbeec00752b6a4e1e9e3b5-00589e2ca4dfw1"
},
{
"name": "Expires",
"value": "Fri, 10 Feb 2017 21:27:33 GMT"
}
],
"cookies": [],
"content": {
"size": 6397,
"mimeType": "image/png"
},
"redirectURL": "",
"headersSize": 433,
"bodySize": 0,
"_transferSize": 0
},
"cache": {},
"timings": {
"blocked": -1,
"dns": -1,
"connect": -1,
"send": 0,
"wait": 0,
"receive": 0,
"ssl": -1
},
"serverIPAddress": "204.2.145.184",
"connection": "989",
"pageref": "page_2"
}
{
"startedDateTime": "2017-02-10T21:23:38.412Z",
"time": 0,
"request": {
"method": "GET",
"url": "http://616206ee2c1b2155fd11-21abbde6fa52e03b7fd037b3488bb991.r53.cf1.rackcdn.com/images/default-source/site-cdn/LoginLogo.png",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Accept",
"value": "image/webp,image/*,*/*;q=0.8"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Accept-Encoding",
"value": "gzip, deflate, sdch"
},
{
"name": "Referer",
"value": "http://authentrip.com/"
},
{
"name": "Host",
"value": "616206ee2c1b2155fd11-21abbde6fa52e03b7fd037b3488bb991.r53.cf1.rackcdn.com"
},
{
"name": "Accept-Language",
"value": "en-US,en;q=0.8"
},
{
"name": "User-Agent",
"value": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36"
}
],
"queryString": [],
"cookies": [],
"headersSize": 428,
"bodySize": 0
},
"response": {
"status": 200,
"statusText": "OK",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Date",
"value": "Fri, 10 Feb 2017 21:21:44 GMT"
},
{
"name": "Origin",
"value": "https://mycloud.rackspace.com"
},
{
"name": "Last-Modified",
"value": "Fri, 09 Dec 2016 05:10:48 GMT"
},
{
"name": "ETag",
"value": "ab904584a8e355da2fd0437065839e10"
},
{
"name": "Content-Type",
"value": "image/png"
},
{
"name": "X-Timestamp",
"value": "1481260247.52133"
},
{
"name": "Cache-Control",
"value": "public, max-age=349"
},
{
"name": "Content-Length",
"value": "6397"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Accept-Ranges",
"value": "bytes"
},
{
"name": "X-Trans-Id",
"value": "txbeec00752b6a4e1e9e3b5-00589e2ca4dfw1"
},
{
"name": "Expires",
"value": "Fri, 10 Feb 2017 21:27:33 GMT"
}
],
"cookies": [],
"content": {
"size": 6397,
"mimeType": "image/png"
},
"redirectURL": "",
"headersSize": 433,
"bodySize": 0,
"_transferSize": 0
},
"cache": {},
"timings": {
"blocked": -1,
"dns": -1,
"connect": -1,
"send": 0,
"wait": 0,
"receive": 0,
"ssl": -1
},
"serverIPAddress": "204.2.145.184",
"connection": "989",
"pageref": "page_3"
}
In fact Chrome does served responses to second and third requests from cache. You need to look at entry.response.bodySize
property.
Relevant excerpt from HAR specification :
bodySize [number] - Size of the received response body in bytes. Set to zero in case of responses coming from the cache (304). Set to -1 if the info is not available.
There is also interesting HAR Viewer GitHub issue . They use function below to determine whether response to request was served from cache:
HarModel.isCachedEntry = function(entry) {
var response = entry.response;
var resBodySize = response.bodySize > 0 ? response.bodySize : 0;
return (response.status == 304 || (resBodySize === 0 && response.content && response.content.size > 0));
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.