aws-cdk-lib.aws_cloudfront.ErrorResponse

interface ErrorResponse

LanguageType name
.NETAmazon.CDK.AWS.CloudFront.ErrorResponse
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awscloudfront#ErrorResponse
Javasoftware.amazon.awscdk.services.cloudfront.ErrorResponse
Pythonaws_cdk.aws_cloudfront.ErrorResponse
TypeScript (source)aws-cdk-lib » aws_cloudfront » ErrorResponse

Options for configuring custom error responses.

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_cloudfront as cloudfront } from 'aws-cdk-lib';
const errorResponse: cloudfront.ErrorResponse = {
  httpStatus: 123,

  // the properties below are optional
  responseHttpStatus: 123,
  responsePagePath: 'responsePagePath',
  ttl: cdk.Duration.minutes(30),
};

Properties

NameTypeDescription
httpStatusnumberThe HTTP status code for which you want to specify a custom error page and/or a caching duration.
responseHttpStatus?numberThe HTTP status code that you want CloudFront to return to the viewer along with the custom error page.
responsePagePath?stringThe path to the custom error page that you want CloudFront to return to a viewer when your origin returns the httpStatus, for example, /4xx-errors/403-forbidden.html.
ttl?DurationThe minimum amount of time, in seconds, that you want CloudFront to cache the HTTP status code specified in ErrorCode.

httpStatus

Type: number

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


responseHttpStatus?

Type: number (optional, default: the error code will be returned as the response code.)

The HTTP status code that you want CloudFront to return to the viewer along with the custom error page.

If you specify a value for responseHttpStatus, you must also specify a value for responsePagePath.


responsePagePath?

Type: string (optional, default: the default CloudFront response is shown.)

The path to the custom error page that you want CloudFront to return to a viewer when your origin returns the httpStatus, for example, /4xx-errors/403-forbidden.html.


ttl?

Type: Duration (optional, default: the default caching TTL behavior applies)

The minimum amount of time, in seconds, that you want CloudFront to cache the HTTP status code specified in ErrorCode.