I want Amazon CloudFront to pass through certain files, instead of caching the files at edge locations. How can I do that?

To prevent Amazon CloudFront from caching certain files, use one of the following configurations on either the origin or the distribution:

Configuration on the origin

On your custom origin web server application, add Cache-Control no-cache, no-store, or private directives to the objects that you don't want CloudFront to cache. If you're using Amazon Simple Storage Service (S3) as the origin, you can add certain Cache-Control headers using object metadata.

Configuration on the distribution

From the Amazon CloudFront console, open your distribution, and then open the cache behavior that serves the files you don't want CloudFront to cache. Be sure that the cache behavior's Minimum TTL is set to 0 seconds.

Note: For Object Caching, if Use Origin Cache Headers is selected, Minimum TTL is 0 by default. If Customize is selected, you might need to change Minimum TTL to 0.

For more information on CloudFront caching, see Specifying the Amount of Time that CloudFront Caches Objects for Web Distributions.


Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2018-06-08