Skip to content

Configure Cloudfront/S3 Caching Behavior #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

brooketopcoder
Copy link
Contributor

@brooketopcoder brooketopcoder commented Dec 6, 2022

This PR sets the cache behavior as follows, which is how I would expect it work given the naming conventions.

If the app enables caching:

  • ENABLE_CACHE = true / CFACHE = true

  • Set the max age in the cache-control for the files in S3 to --cache-control max-age=0,s-maxage=86400, which will allow CloudFront to cache them.

  • Invalidate the CloudFront distribution.

If the app disables caching:

  • ENABLE_CACHE = false / CFCACHE = false

  • Set the max age in the cache-control for the files in S3 to --cache-control private,no-store,no-cache,must-revalidate,max-age=0, which will prevent CloudFront from ever caching it.

  • Do not invalidate the CloudFront distribution because the cache-control on the files renders cache invalidation irrelevant.

@brooketopcoder brooketopcoder changed the title Configure Platform UI Preferred Caching Configure Preferred Caching Behavior Dec 6, 2022
@brooketopcoder brooketopcoder changed the title Configure Preferred Caching Behavior Configure Cloudfront/S3 Caching Behavior Dec 6, 2022
… condition

Added fix to invalidate cache, if cloundfront it provided without any condition
@Gunasekar-K Gunasekar-K merged commit b07c854 into topcoder-platform:master Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants