2

When I load my HTML page in my browser, all requests for assets have x-cache: Miss from cloudfront. If I reload my browser very quickly, I can sometimes get a Hit.

If I open my developer tools and "copy request as curl", I reliably get a hit, no matter how fast or slowly I perform the requests.

Why would different user agents making the exact same request get a hit or miss?

spiffytech
  • 1,063
  • 2
  • 11
  • 17

1 Answers1

0

Probably you are fowarding the cookies on Cloudfront.

So every time you refresh the page in a browser, the browser creates a new cookie hash and the CDN thinks it's a new request.

You have to turn off cookie fowarding at Cloudfront.

To replicate this behaviour in CURL try sending the request with a different cookie and you will see it slowing down.

Daniel K
  • 649
  • 1
  • 4
  • 16