AWS::CloudFront::Distribution CustomErrorResponse - AWS CloudFormation (original) (raw)

A complex type that controls:

For more information about custom error pages, see Customizing Error Responses in the Amazon CloudFront Developer Guide.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{
  "ErrorCachingMinTTL" : Number,
  "ErrorCode" : Integer,
  "ResponseCode" : Integer,
  "ResponsePagePath" : String
}

YAML

  ErrorCachingMinTTL: Number
  ErrorCode: Integer
  ResponseCode: Integer
  ResponsePagePath: String

Properties

ErrorCachingMinTTL

The minimum amount of time, in seconds, that you want CloudFront to cache the HTTP status code specified in ErrorCode. When this time period has elapsed, CloudFront queries your origin to see whether the problem that caused the error has been resolved and the requested object is now available.

For more information, see Customizing Error Responses in the Amazon CloudFront Developer Guide.

Required: No

Type: Number

Update requires: No interruption

ErrorCode

The HTTP status code for which you want to specify a custom error page and/or a caching duration.

Required: Yes

Type: Integer

Update requires: No interruption

ResponseCode

The HTTP status code that you want CloudFront to return to the viewer along with the custom error page. There are a variety of reasons that you might want CloudFront to return a status code different from the status code that your origin returned to CloudFront, for example:

If you specify a value for ResponseCode, you must also specify a value for ResponsePagePath.

Required: Conditional

Type: Integer

Update requires: No interruption

ResponsePagePath

The path to the custom error page that you want CloudFront to return to a viewer when your origin returns the HTTP status code specified by ErrorCode, for example,/4xx-errors/403-forbidden.html. If you want to store your objects and your custom error pages in different locations, your distribution must include a cache behavior for which the following is true:

If you specify a value for ResponsePagePath, you must also specify a value for ResponseCode.

We recommend that you store custom error pages in an Amazon S3 bucket. If you store custom error pages on an HTTP server and the server starts to return 5xx errors, CloudFront can't get the files that you want to return to viewers because the origin server is unavailable.

Required: Conditional

Type: String

Update requires: No interruption

See also

Cookies

CustomOriginConfig

Did this page help you? - Yes

Thanks for letting us know we're doing a good job!

If you've got a moment, please tell us what we did right so we can do more of it.

Did this page help you? - No

Thanks for letting us know this page needs work. We're sorry we let you down.

If you've got a moment, please tell us how we can make the documentation better.