Skip to content

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

2 minute read
0

My Amazon CloudFront distribution returned "HTTP 404 (Not Found)" errors when viewers requested files or objects.

Resolution

Follow these troubleshooting steps to resolve the error message HTTP 404 status code (Not Found) for your CloudFront distribution configuration.

NoSuchBucket error message

If the Amazon Simple Storage Service (Amazon S3) bucket doesn't exist, then you might receive an "HTTP 404 (Not Found) error" with the error message NoSuchBucket. For example, you used an Amazon S3 bucket as the origin, but the bucket policy doesn't exist or isn't valid.

You might also receive this error code if you configured CloudFront to forward the host header to the origin. If the AllViewer managed policy or a custom policy includes the Host header, then you receive this error code. To resolve this error, remove the Host header from the policy, or use the CachingOptimized policy.

HTTP 404 error with an Amazon S3 origin

If you used an Amazon S3 bucket as the origin for your CloudFront distribution, then you might receive the HTTP 404 error. To resolve this error, check the origin settings. Make sure that the origin domain name for the S3 bucket and origin path URL are correct.

For more information, see Origin path.

HTTP 404 error with a custom origin

If your CloudFront distribution is configured with a custom origin, then you might receive the HTTP 404 error. To resolve this error, make sure that your web server settings are correct. Verify that the requested file exists in the origin and the request URL's path matches the file path in the origin.

If you use Amazon Elastic Compute Cloud (Amazon EC2) for your custom origin, then check your origin server configuration settings. Make sure that you specify the URL of the load balancer for the domain name of your origin server.

HTTP 404 error from a custom error page

If your CloudFront distribution is configured with a custom error page for HTTP status codes, then the HTTP 404 error might be intentional. Check your distribution to see if it's configured with a custom error response.

If your distribution used a custom error page that's accidentally deleted, then the response returns the HTTP 404 error for the deleted custom error page.

For more information, see How CloudFront processes errors when you have configured custom error pages.

AWS OFFICIALUpdated 6 months ago