After uploading new files to my S3 bucket, the browser continues to load old files. I run S3 invalidations on all files in Cloudfront which sits in front of my S3 app.
If I have the browser open to my website, I need to refresh several times to see the updated files. I would think that renaming the Javascript file would help, however, the browser is somehow loading the old file probably due to browser cache.
If I clear my browser cache or open in incognito mode, I see the updates immediately. Obviously, I can't tell my users to clear their cache every time I make an update. Is there a solution to this? I often make changes to my API at the same time that the new front-end is dependent on. How can I be sure the newest files are loaded?
Details: I'm using create-react-app to bundle my S3 app together.