Reputation: 2883
I have a query related to invalidation.
I have a test page created on s3 bucket. The TTL set on Cloudfront is 1 week. But I have made some changes to the test page. I ran the invalidation as '/*' and expected all files to be evicted from the cache.
But still the pages are getting served from Cloudfront cache --> response header says 'x-cache: Hit from cloudfront'
I am not sure what I am missing here, kindly suggest. Thanks a lot for your suggestions.
Upvotes: 7
Views: 11482
Reputation: 11772
My problem was I ran the following command on macOS:
aws --profile myprofile cloudfront create-invalidation --distribution-id someID --paths /*
Turns out my shell expanded /*
to the following paths leading to a wrong invalidation:
/Applications
/home
/Volumes
/private
/Users
/bin
/sbin
/var
/dev
/usr
...
Escaping /*
to '/*'
fixed the issue:
aws --profile myprofile cloudfront create-invalidation --distribution-id someID --paths '/*'
Upvotes: 7
Reputation: 7327
I was trying trying to invalidate an endpoint /contact
in a S3
static website fronted by Cloudfront
I went to Cloudfront
-> Distribution
-> Invalidations
and input /contact
and it wasn't working.
turns out, my /contact
was actually served by /contact/index.html
in S3
.
To actually invalidate, I made my Invalidation:
/contact/*
Upvotes: 1
Reputation: 27
I had a similar issue.
In my case everything was correctly connected(correct S3 bucket). But still I had this issue.
I fixed it by opening my CloudFront distribution and going in Behaviors
tab. After that edit each behavior and change Cache Policy
to Managed-CachingDisabled
This will disable caching entirely.
Upvotes: 0