ErrorResponse

class aws_cdk.aws_cloudfront.ErrorResponse(*, http_status, response_http_status=None, response_page_path=None, ttl=None)

Bases: object

Options for configuring custom error responses.

Parameters:
  • http_status (Union[int, float]) – The HTTP status code for which you want to specify a custom error page and/or a caching duration.

  • response_http_status (Union[int, float, None]) – 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. Default: - the error code will be returned as the response code.

  • response_page_path (Optional[str]) – 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. Default: - the default CloudFront response is shown.

  • ttl (Optional[Duration]) – The minimum amount of time, in seconds, that you want CloudFront to cache the HTTP status code specified in ErrorCode. Default: - the default caching TTL behavior applies

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront
import aws_cdk.core as cdk

error_response = cloudfront.ErrorResponse(
    http_status=123,

    # the properties below are optional
    response_http_status=123,
    response_page_path="responsePagePath",
    ttl=cdk.Duration.minutes(30)
)

Attributes

http_status

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

response_http_status

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.

Default:
  • the error code will be returned as the response code.

response_page_path

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.

Default:
  • the default CloudFront response is shown.

ttl

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

Default:
  • the default caching TTL behavior applies