How do I troubleshoot HTTP 404 (Not Found) errors in CloudFront?

2 minute read
0

My Amazon CloudFront distribution is returning HTTP 404 (Not Found) errors. Why is this happening, and how do I troubleshoot the issue?

Short description

If the requested file isn't present in the origin configured on the CloudFront distribution, the origin returns an HTTP 404 (Not Found) status code. CloudFront then returns the status code to the viewer.

Resolution

To troubleshoot HTTP 404 (Not Found) errors in CloudFront, verify the following:

1.    The requested file is present in the origin.

2.    The request URL's path matches the file path in the origin.

Important: Make sure that the request URL's path includes the entire file path, including the object name. You can use an edge function to attach the full file path to the request before the request is forwarded to the origin.

3.    (For distributions that use edge functions) The function is modifying the request URL path correctly. To verify, review your Lambda@Edge logs or CloudFront Functions logs.

4.    (For distributions with multiple origins) The request is being sent to the correct origin. To verify, review the path patterns specified in your distribution's Cache behavior settings. Then, make sure that the request URL matches the intended path pattern.

Important: CloudFront path patterns and references to objects in Amazon Simple Storage Service (Amazon S3) are case sensitive.


AWS OFFICIAL
AWS OFFICIALUpdated 2 years ago