I have deployed my React
app on s3
. I am using Cloudfront to use a certificate and reach my s3 bucket
through HTTPS
.
After struggling setting it all up, I managed to set it all up, it is now working well.
Now I updated my project, created a new version of bundle.js
, uploaded it to s3
.
My issue now is that mydomain.com
points to the V1 of bundle.js
So what I tried to dig up a little bit more, and here is what I found:
mydomain.com
points to V1xxxxx.cloudfront.net
points to V1mydomain.com.s3-website-eu-west-1.amazonaws.com
points to V2So my guess is that for some reason, cloudfront
points to the V1, but why ? Is there some cache somewhere in there ?
Here is the config, in case it helps:
Route53
Type A
points to xxxxxx.cloudfront.net
cloudfront
domain is xxxxxx.cloudfront.net
cloudfront
CNAMES
are mydomain.com
and www.mydomain.com
cloudfront
origin domain name and path
is mydomain.com.s3-website-eu-west-1.amazonaws.com
s3 bucket
is mydomain.com
PS : Just to double check that the issue was not only coming from bundle.js
, I deleted the background image from the bucket, but somehow, it is still found and used when accessing mydomain.com
(so showing the V1)
As @Joe Clay confirmed, Cloudfront
was caching everything.
To force clear the cache using the AWS console
(I found in some docs that it can be done using their API
), here are the steps I followed:
AWS console
Cloudfront
and see details of your distributioninvalidations
tab, and click on Create invalidation
*
and savemydomain.com
(might need to clean the browser cache)Hope this answer can help anyone stuck with the same problem!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With