I created a custom cache behavior for a specific URL path pattern on my distribution, but Amazon CloudFront isn't following the cache behavior. Why?

If your CloudFront distribution isn't following a cache behavior that you created, check the following:

  • Review your distribution's behaviors to be sure that there is a cache behavior for your requested path pattern. If the requested path pattern isn't correctly defined in a cache behavior, CloudFront uses the default cache behavior. For example, if you create a cache behavior with the Path Pattern set to test/ and you make a request to example.com/test/file1.jpg, then the request follows the default cache behavior instead of the behavior that you created because the path pattern is missing a wildcard at the end of the path (test/*).

  • Review the path pattern specified in the cache behavior to be sure that the capitalization is correct. Path patterns specified in CloudFront are case-sensitive. References to buckets or objects in Amazon Simple Storage Service (S3) are also case-sensitive. If a specified path pattern has incorrect capitalization and your default cache behavior doesn't cache the requested content, users might receive an HTTP 404 (Not Found) error.

Note: CloudFront doesn't generate HTTP 404 responses. If a requested object isn't found in a CloudFront cache, the request is sent to the origin and the origin generates the HTTP 404 response.


Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2018-06-28