Struct aws_sdk_cloudfront::model::CustomErrorResponse
source · [−]#[non_exhaustive]pub struct CustomErrorResponse {
pub error_code: Option<i32>,
pub response_page_path: Option<String>,
pub response_code: Option<String>,
pub error_caching_min_ttl: Option<i64>,
}
Expand description
A complex type that controls:
-
Whether CloudFront replaces HTTP status codes in the 4xx and 5xx range with custom error messages before returning the response to the viewer.
-
How long CloudFront caches HTTP status codes in the 4xx and 5xx range.
For more information about custom error pages, see Customizing Error Responses in the Amazon CloudFront Developer Guide.
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.error_code: Option<i32>
The HTTP status code for which you want to specify a custom error page and/or a caching duration.
response_page_path: Option<String>
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:
-
The value of
PathPattern
matches the path to your custom error messages. For example, suppose you saved custom error pages for 4xx errors in an Amazon S3 bucket in a directory named/4xx-errors
. Your distribution must include a cache behavior for which the path pattern routes requests for your custom error pages to that location, for example,/4xx-errors/*
. -
The value of
TargetOriginId
specifies the value of theID
element for the origin that contains your custom error pages.
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.
response_code: Option<String>
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:
-
Some Internet devices (some firewalls and corporate proxies, for example) intercept HTTP 4xx and 5xx and prevent the response from being returned to the viewer. If you substitute
200
, the response typically won't be intercepted. -
If you don't care about distinguishing among different client errors or server errors, you can specify
400
or500
as theResponseCode
for all 4xx or 5xx errors. -
You might want to return a
200
status code (OK) and static website so your customers don't know that your website is down.
If you specify a value for ResponseCode
, you must also specify a value for ResponsePagePath
.
error_caching_min_ttl: Option<i64>
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.
Implementations
sourceimpl CustomErrorResponse
impl CustomErrorResponse
sourcepub fn error_code(&self) -> Option<i32>
pub fn error_code(&self) -> Option<i32>
The HTTP status code for which you want to specify a custom error page and/or a caching duration.
sourcepub fn response_page_path(&self) -> Option<&str>
pub fn response_page_path(&self) -> Option<&str>
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:
-
The value of
PathPattern
matches the path to your custom error messages. For example, suppose you saved custom error pages for 4xx errors in an Amazon S3 bucket in a directory named/4xx-errors
. Your distribution must include a cache behavior for which the path pattern routes requests for your custom error pages to that location, for example,/4xx-errors/*
. -
The value of
TargetOriginId
specifies the value of theID
element for the origin that contains your custom error pages.
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.
sourcepub fn response_code(&self) -> Option<&str>
pub fn response_code(&self) -> Option<&str>
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:
-
Some Internet devices (some firewalls and corporate proxies, for example) intercept HTTP 4xx and 5xx and prevent the response from being returned to the viewer. If you substitute
200
, the response typically won't be intercepted. -
If you don't care about distinguishing among different client errors or server errors, you can specify
400
or500
as theResponseCode
for all 4xx or 5xx errors. -
You might want to return a
200
status code (OK) and static website so your customers don't know that your website is down.
If you specify a value for ResponseCode
, you must also specify a value for ResponsePagePath
.
sourcepub fn error_caching_min_ttl(&self) -> Option<i64>
pub fn error_caching_min_ttl(&self) -> Option<i64>
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.
sourceimpl CustomErrorResponse
impl CustomErrorResponse
sourcepub fn builder() -> Builder
pub fn builder() -> Builder
Creates a new builder-style object to manufacture CustomErrorResponse
Trait Implementations
sourceimpl Clone for CustomErrorResponse
impl Clone for CustomErrorResponse
sourcefn clone(&self) -> CustomErrorResponse
fn clone(&self) -> CustomErrorResponse
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for CustomErrorResponse
impl Debug for CustomErrorResponse
sourceimpl PartialEq<CustomErrorResponse> for CustomErrorResponse
impl PartialEq<CustomErrorResponse> for CustomErrorResponse
sourcefn eq(&self, other: &CustomErrorResponse) -> bool
fn eq(&self, other: &CustomErrorResponse) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &CustomErrorResponse) -> bool
fn ne(&self, other: &CustomErrorResponse) -> bool
This method tests for !=
.
impl StructuralPartialEq for CustomErrorResponse
Auto Trait Implementations
impl RefUnwindSafe for CustomErrorResponse
impl Send for CustomErrorResponse
impl Sync for CustomErrorResponse
impl Unpin for CustomErrorResponse
impl UnwindSafe for CustomErrorResponse
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more