We are using CloudFront as a CDN. The majority of our objects are caching correctly. For example,
https://static-d8.raystedman.org/theme/css/font-lato.css
This returns a Hit from CloudFront as you would expect.
We found that other objects always result in a "Miss from cloudfront" -- even with multiple requests to ensure the cache is loaded. For example,
[rsm@ray08 ~]$ h https://static-d8.raystedman.org/sites/default/files/css/css_U0-kHZ4VMcN4EKChPMkCrxU_94TFasPMQsBz33LXPAc.css
Array
(
[0] => HTTP/1.1 200 OK
[Content-Type] => text/css
[Content-Length] => 212893
[Connection] => close
[Server] => nginx
[Date] => Mon, 20 Dec 2021 15:02:21 GMT
[Last-Modified] => Thu, 25 Nov 2021 11:07:28 GMT
[Cache-Control] => public, s-maxage=31104000, max-age=31104000
[Expires] => Mon, 03 Jan 2022 15:02:21 GMT
[ETag] => "619f6e70-33f9d"
[X-Powered-By] => PleskLin
[Access-Control-Allow-Origin] => *
[Accept-Ranges] => bytes
[Vary] => Accept-Encoding
[X-Cache] => Miss from cloudfront
[Via] => 1.1 7b00c3fd9220034414107b03e53b1b8f.cloudfront.net (CloudFront)
[X-Amz-Cf-Pop] => SFO5-P2
[X-Amz-Cf-Id] => 0Mu6SkFY50W5MxfeuzhO0a-hhbDgcQqpYVaRZoT0HbWwfJQ6L5e02Q==
)
This Miss results in CloudFront accessing the origin with (which is logged at the origin):
[rsm@ray08 ~]$ h https://static-d8-origin.raystedman.org/sites/default/files/css/css_U0-kHZ4VMcN4EKChPMkCrxU_94TFasPMQsBz33LXPAc.css
Array
(
[0] => HTTP/1.1 200 OK
[Server] => nginx
[Date] => Mon, 20 Dec 2021 15:09:31 GMT
[Content-Type] => text/css
[Content-Length] => 212893
[Last-Modified] => Thu, 25 Nov 2021 11:07:28 GMT
[Connection] => close
[Cache-Control] => public, s-maxage=31104000, max-age=31104000
[Expires] => Mon, 03 Jan 2022 15:09:31 GMT
[ETag] => "619f6e70-33f9d"
[X-Powered-By] => PleskLin
[Access-Control-Allow-Origin] => *
[Accept-Ranges] => bytes
)
The Behaviors for these two objects are setup the same way in the Distribution. How can I figure out why the second object is always a CloudFront Miss?
https://static-d8.raystedman.org/sites/default/files/css/css_U0-kHZ4VMcN4EKChPMkCrxU_94TFasPMQsBz33LXPAc.css
showsx-cache: Miss from cloudfront
for the first request thenx-cache: Hit from cloudfront
for the second.access-control-allow-origin: *