Create a custom error page for specific HTTP status codes (original) (raw)

If you’d rather display a custom error message instead of the default message—for example, a page that uses the same formatting as the rest of your website—you can have CloudFront return to the viewer an object (such as an HTML file) that contains your custom error message.

To specify the file that you want to return and the errors for which the file should be returned, you update your CloudFront distribution to specify those values. For more information, see Configure error response behavior.

For example, the following is a custom error page:

Screenshot of an example custom AWS 404 page.

You can specify a different object for each supported HTTP status code, or you can use the same object for all of the supported status codes. You can choose to specify custom error pages for some status codes and not for others.

The objects that you’re serving through CloudFront can be unavailable for a variety of reasons. These fall into two broad categories:

The HTTP status codes for which CloudFront can return a custom error page include the following:

Notes

For a detailed explanation of how CloudFront handles error responses from your origin, seeHow CloudFront processes HTTP 4xx and 5xx status codes from your origin.