set up custom domain then my link always returns "X-Cache: Miss from cloudfront"
I'm trying to solve my problem like (issue #160) I using my domain on cloudflare because I want to use Firewall from cloudflare to prevent hotlink but i keep getting x-cache miss if I using cloudflare by poiting my custom domain from cloudflare to API gateway Distribution instead of cloudfront Distribution here is my link https://api.cloudimagewall.xyz/401x0/toi-la-nguoi-choi-duy-nhat-dang-nhap/chapter-2/1620552516056-0_1.jpg But it not worked, I still got x-cache miss even I Crtl F5 to reload several times
Can someone help me please 😭 I just want to make hotlink protection but issue keep coming XD
I stuck so long in this
@onggiabayluon Thanks for contacting us. I've researched this one a bit, and I think this could be helpful for you. https://community.cloudflare.com/t/cloudflare-and-cloudfront-show-cache-hit/129955
Since you're using CloudFlare in front of CloudFront, I think your CloudFlare caches the result from the CloudFront. Therefore, in the response headers, you would see cf-cache-status header is HIT but x-cache header is Miss from cloudfront.
@onggiabayluon Thanks for contacting us. I've researched this one a bit, and I think this could be helpful for you. https://community.cloudflare.com/t/cloudflare-and-cloudfront-show-cache-hit/129955
Since you're using CloudFlare in front of CloudFront, I think your CloudFlare caches the result from the CloudFront. Therefore, in the response headers, you would see
cf-cache-statusheader isHITbutx-cacheheader isMiss from cloudfront.
Ah, I think you're right. Because Cloudflare Cache layer on top of the cloudfront make cloudfront x-cache always show miss if I purge Cloudflare cache then I can see x-cache get Hit
my Solution to fix this problem is set a rule in cloudflare like this:
so this setting mean disable cache on Cloudflare
then the result now I get x-cache hit in Cloudfront normally

I dont know if this is ok to remove Cloudflare Cache like this, After all I can use Cloudflare Firewall to block referer header now and my cloudfront x-cache also Hit I really appreciate your help