I have a website, but every time I upload a new update or feature I'm afraid it won't show up to the user.
It has happened a few times, we uploaded something new, but for some users, it didn't appear. The old information was left and it only appeared after a while.
As I know that no users will clear their browser cache to prevent this, I would like to know if there is anything I can do on the development side to prevent this, and every time I upload something new, neither user will experience any problems or will not receive the news.
I currently use AWS services like ec2, es3, bucket. cloud front and route 53
CodePudding user response:
What to do
Actions to perform summarized with screenshots really elegantly here: https://stackoverflow.com/a/60049652/14077491
Why to do it
When someone makes a request to your website, AWS automatically caches the result in edge locations to speed up the response time for subsequent requests. The default is 24 hours, but this can be modified.
You can bypass this by either (1) setting the cache expiration to a very short time span, or (2) using cache invalidation. The first is not recommended since then your users will have to wait longer for a response more often, which isn't good. You can perform cache invalidation in a couple of ways, depending on whichever is better for your project. You can read the AWS docs about cache invalidation to choose for your use case.
I have previously added an extra cache invalidation task to my CD pipeline, which automates the process and ensures it is never forgotten. Unless you are posting many, many updates per month, it is also free.