Miss From Cloudfront: X-cache

24 Views Asked by At

Ok so I follow this to setup the cache-control in my cloudfront: How to cache images on AWS CloudFront

And just a short explanation of the architecture, there is ec2 (serving API and WS) and s3 (frontend) behind the cloudfront. So i want to cache the API response from the ec2, and here is the setup of behaviors in the cloudfront. behaviors setup

And below is the cache-control headers cache-control setup

I get all miss from cloudfront as shown below (even after second request)

Access-Control-Expose-Headers:Access-Token, Session
Cache-Control:max-age=7200
Content-Length:    258478
Content-Type:    application/json
Date:    Thu, 21 Mar 2024 09:34:53 GMT
Server:    nginx/1.18.0 (Ubuntu)
Session:    True
Vary:    Origin
Via:    1.1 428e308f6493e8c2a9e7e3b80d632f44.cloudfront.net (CloudFront)
X-Amz-Cf-Id:    eS-cyahrcR4VJ5n0Hu9_tWHErUYql5PtPt_DlP2yXhfHqTq8tj63Vw==
X-Amz-Cf-Pop:    NRT57-P4
X-Cache:    Miss from cloudfront

After walking through lots of post related to this question on stackoverflow nothing works at the end. Can anyone please point me out whats wrong?

0

There are 0 best solutions below