Open klequis opened 5 years ago
from: link
To change the cache duration for all files that match the same path pattern, you can change the CloudFront settings for Minimum TTL, Maximum TTL, and Default TTL for a cache behavior. For information about the individual settings, see Minimum TTL, Maximum TTL, and Default TTL in Values That You Specify When You Create or Update a Distribution. To use these settings, you must choose the Customize option for the Object Caching setting when you create or update your CloudFront distribution. For more information, see Object Caching in Values That You Specify When You Create or Update a Distribution.
To change the cache duration for an individual file, you can configure your origin to add a Cache-Control max-age or Cache-Control s-maxage directive, or an Expires header field to the file. For more information, see Using Headers to Control Cache Duration for Individual Objects.
So the correct approach is to use settings in #1. I currently have this set very low so I can iterate versions during active development.
When deploying a new version of the app to S3, CloudFront (CF) does not update for 24+ hours.
To force a CF update you can create an invalidation
However, using file versioning makes this automatic.
invalidating files