Chrome does not request with If-None-Match


#1

I apologize if this is in the wrong category.

TL;DR - Chrome does not appear to be making requests to fastly with If-None-Match headers, and I can’t figure out why. Do I have conflicting headers that would cause Chrome to not cache correctly? (I’ve double checked, I do not have “Disable cache” checkmarked in the console)

We have an nginx origin server, it’s configured to send a 30 day expiration, with public cache control.

location / {
  try_files $uri $uri/ =404;
  expires 30d;
  add_header Pragma public;
  add_header Cache-Control "public";
}

Fastly is currently setup to inject the CORS header, and handle our gzip compression for us.

In Firefox, Safari, and curls I can properly get fastly to respond with a 304. But we can’t seem to accomplish the same with Chrome. Every asset in Chrome is marked as a 200 OK (from disk cache). IE is currently untested.

The response headers in the console show the proper cache-control and etag response, but the requests are never made with If-None-Match headers.

The fastly dashboard is also showing a lot of 200 responses, with very few 304 responses being served.

Chrome 200 request / response

Fastly 200 response

curl -svo /dev/null https://static7shifts.global.ssl.fastly.net/0a40bc4f60957db0b7a62b6763d37cccba6ae43d/vendors/compiled-vendors.js
*   Trying 151.101.64.249...
* TCP_NODELAY set
* Connected to static7shifts.global.ssl.fastly.net (151.101.64.249) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: a.ssl.fastly.net
* Server certificate: DigiCert SHA2 High Assurance Server CA
* Server certificate: DigiCert High Assurance EV Root CA
> GET /0a40bc4f60957db0b7a62b6763d37cccba6ae43d/vendors/compiled-vendors.js HTTP/1.1
> Host: static7shifts.global.ssl.fastly.net
> User-Agent: curl/7.51.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Server: nginx/1.10.0 (Ubuntu)
< Content-Type: application/javascript
< Last-Modified: Wed, 22 Feb 2017 22:13:09 GMT
< ETag: "58ae0cf5-27a0e"
< Expires: Sat, 25 Mar 2017 15:46:42 GMT
< Cache-Control: max-age=2592000, public
< Pragma: public
< Content-Length: 162318
< Accept-Ranges: bytes
< Date: Thu, 23 Feb 2017 15:46:55 GMT
< Via: 1.1 varnish
< Age: 12
< Connection: keep-alive
< X-Served-By: cache-yyz8323-YYZ
< X-Cache: HIT
< X-Cache-Hits: 1
< X-Timer: S1487864815.421380,VS0,VE2
< Vary: Accept-Encoding
< Access-Control-Allow-Origin: *
< 
{ [2216 bytes data]
* Curl_http_done: called premature == 0
* Connection #0 to host static7shifts.global.ssl.fastly.net left intact

Fastly 304 response

curl -svo /dev/null -H 'If-None-Match: "58ae0cf5-27a0e"' https://static7shifts.global.ssl.fastly.net/0a40bc4f60957db0b7a62b6763d37cccba6ae43d/vendors/compiled-vendors.js
*   Trying 151.101.64.249...
* TCP_NODELAY set
* Connected to static7shifts.global.ssl.fastly.net (151.101.64.249) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: a.ssl.fastly.net
* Server certificate: DigiCert SHA2 High Assurance Server CA
* Server certificate: DigiCert High Assurance EV Root CA
> GET /0a40bc4f60957db0b7a62b6763d37cccba6ae43d/vendors/compiled-vendors.js HTTP/1.1
> Host: static7shifts.global.ssl.fastly.net
> User-Agent: curl/7.51.0
> Accept: */*
> If-None-Match: "58ae0cf5-27a0e"
> 
< HTTP/1.1 304 Not Modified
< Date: Thu, 23 Feb 2017 15:47:26 GMT
< Via: 1.1 varnish
< Cache-Control: max-age=2592000, public
< ETag: "58ae0cf5-27a0e"
< Expires: Sat, 25 Mar 2017 15:46:42 GMT
< Age: 43
< Connection: keep-alive
< X-Served-By: cache-yyz8329-YYZ
< X-Cache: HIT
< X-Cache-Hits: 1
< X-Timer: S1487864846.369334,VS0,VE0
< Vary: Accept-Encoding
< Access-Control-Allow-Origin: *
< 
* Curl_http_done: called premature == 0
* Connection #0 to host static7shifts.global.ssl.fastly.net left intact

Any help is appreciated, thanks a lot!