CloudFront serving outdated content from Amazon S3? - amazon-web-services

I'm storing a static web site on Amazon S3 and delivering by Cloudfront. I pushed changes to S3 but Cloudfront is still showing the old files. I made an invalidation in Cloudfront with this path /* which is supposed to clear tho whole cache but it still shows the old staff. I'm wondering how to solve this.

Related

Static website using S3 Route53 and CloudFront displaying outdated content

After initially uploading the website, it was working perfectly. After some time, however, I uploaded a new index.html to my S3 bucket and saved the changes. After opening my website, it's still showing me the content of my old index.html page. Why?
Eventually CloudFront will pick up the new version (it caches files at many locations, which is the whole point of using it), but it can take a while for updated files to be distributed - usually longer than I like, so I either issue an AWS CLI command to create a CloudFront invalidation, or do it thru the console.
Invalidating Files - Amazon CloudFront

How to use Amazon Cloudfront CDN with a website hosted on DreamHost (without S3)

A client of mine has his website domain and hosting with. We'd like to use Amazon CloudFront as CDN, but we don't want to use S3 – we'd like to keep the site files where they are on DreamHost's servers.
I'm pretty sure this is possible, since CloudFront does allow custom origins, and I signed up for CloudFront, but I am unsure how to fill out the form (what to put for origin name, etc...) even after reading the pop-up help. We are on the bellfountain server of DreamHost.
What I've Tried
I did see the "create amazon cloudfront distribution not using amazon S3 bucket" question, and that is basically what I am after, but it wasn't specific enough for my needs.
I have also tried posting on the CloudFront forum, but that was less than helpful (no one responded after almost a month).
I've scoured Amazon's documentation (which is very thorough, I'll admit), but the most detailed information is for users of S3, and the stuff about using a custom domain again wasn't specific enough for me to figure it out. We do not have a paid support plan.
I tried chatting with DreamHost support, but they didn't even know what Amazon CloudFront was, and couldn't help me fill in the CloudFront information form. I looked around DreamHost's settings, etc. for things with similar names as what was being requested on the CloudFront form, but couldn't find anything.
Pretty much if you just put in: http://www.yourdomain.com, cloudfront figures out the rest - and you can customize from there if you need/want to - but just doing that one entry, and creating the distribution will setup a cloudfront end-point to serve the files from your external webserver - just make sure you include the 'http://' in front of the url so it can figure out the rest.

Use S3 for website in multi-regions

I want to host my website in S3 (because it seems cheaper and i don't have server side script). I have a domain, and i want my domain link to my S3 website. So far, what i do is enabling Static website hosting in my S3 website bucket, and set Route53 record set's Alias Target to my S3 website. it's working. But it's not good enough, i want it to deal with multi regions.
I know that Transfer acceleration can auto sync files to other regions so it's faster for other regions. But i don't know how to make it work with Route53. I hear that some people uses CloudFront to do that but i don't quite understand how. And i don't want to manually create buckets in several regions and manually set up for each region
do you have any suggestion for me?
If your goal is to reduce latency for users worldwide, then Amazon CloudFront is definitely the way to go.
Amazon CloudFront has over 100 edge locations globally, so it has more coverage than merely using AWS regions.
You simply create a CloudFront distribution, point it to your S3 bucket and then point your domain name to CloudFront.
Whenever somebody accesses your content, CloudFront will retrieve it from S3 and cache it in the edge location closest to that user. Then, other users who want the data will receive it from the local cache. Thus, your website appears fast for many users.
See also: Amazon CloudFront pricing

Amazon CloudFront not showing updated headers in S3 files

I am using Amazon CloudFront with the files coming from Amazon S3. I wasn't originally setting the Amazon S3 Metadata to send a Cache-Control header, but I changed it a few weeks ago. Most of the images are showing with the new header. However, I have some that still do not.
For example if I hit this
https://s3.us-east-2.amazonaws.com/channelnet-useast-prod/Themes/Default/Images/phone.png, I see
Cache-Control:max-age=86400
But if I go to the CloudFront URL that points to that S3 image
http://dfb8oqhjho7zs.cloudfront.net/Themes/Default/Images/phone.png, I do not.
As a test, I made a copy of the image, uploaded it to S3, set the Cache-Control header, and verified the header is set when I access it via S3
https://s3.us-east-2.amazonaws.com/channelnet-useast-prod/Themes/Default/Images/phone-matttest.png
or CloudFront
http://dfb8oqhjho7zs.cloudfront.net/Themes/Default/Images/phone-matttest.png
How do I get CloudFront to refresh whatever Amazon-side caching is going on here?
You need to clear/invalidate the CloudFront cache so that it will check your origin for updates.

Does cloudfront support questionsmarks at URLs to fetch a new resource

We are porting a website to a AWS cloudfront backed infrastructure which serves static resource from an S3 bucket.
We access the resource like this
http://example.com/static/foo.css?hash=1
Our CMS generates a new hash when the files changed (cachebusting).
So we upload the file foo.css to the S3 bucket and access
http://example.com/static/foo.css?hash=2
But still the old contents are displayed. It seems to be cached in cloudfront?
Can this be avoided?
Or does the cms need to be modified?
You have to configure your CloudFront distribution to forward query parameters and use them as part of the cache key. Documented here.