Interface CfnDistribution.ICustomErrorResponseProperty
A complex type that controls:.
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface ICustomErrorResponseProperty
Syntax (vb)
Public Interface ICustomErrorResponseProperty
Remarks
For more information about custom error pages, see Customizing Error Responses in the Amazon CloudFront Developer Guide .
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.CloudFront;
var customErrorResponseProperty = new CustomErrorResponseProperty {
ErrorCode = 123,
// the properties below are optional
ErrorCachingMinTtl = 123,
ResponseCode = 123,
ResponsePagePath = "responsePagePath"
};
Synopsis
Properties
ErrorCachingMinTtl | The minimum amount of time, in seconds, that you want CloudFront to cache the HTTP status code specified in |
ErrorCode | The HTTP status code for which you want to specify a custom error page and/or a caching duration. |
ResponseCode | The HTTP status code that you want CloudFront to return to the viewer along with the custom error page. |
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 |
Properties
ErrorCachingMinTtl
The minimum amount of time, in seconds, that you want CloudFront to cache the HTTP status code specified in ErrorCode
.
virtual Nullable<double> ErrorCachingMinTtl { get; }
Property Value
System.Nullable<System.Double>
Remarks
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 .
Default: - 300
ErrorCode
The HTTP status code for which you want to specify a custom error page and/or a caching duration.
double ErrorCode { get; }
Property Value
System.Double
Remarks
ResponseCode
The HTTP status code that you want CloudFront to return to the viewer along with the custom error page.
virtual Nullable<double> ResponseCode { get; }
Property Value
System.Nullable<System.Double>
Remarks
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
.
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:.
virtual string ResponsePagePath { get; }
Property Value
System.String
Remarks
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.