customErrorResponsePolicy property
customErrorResponsePolicy specifies how the Load Balancer returns error responses when BackendServiceorBackendBucket responds with an error.
If a policy for an error code is not configured for the PathRule, a policy for the error code configured inpathMatcher.defaultCustomErrorResponsePolicy is applied. If one is not specified inpathMatcher.defaultCustomErrorResponsePolicy, the policy configured in UrlMap.defaultCustomErrorResponsePolicy takes effect.
For example, consider a UrlMap with the following configuration:
- UrlMap.defaultCustomErrorResponsePolicy are configured
with policies for 5xx and 4xx errors
- A PathRule for /coming_soon/ is configured for the error
code 404.
If the request is for www.myotherdomain.com and a404 is encountered, the policy underUrlMap.defaultCustomErrorResponsePolicy takes effect. If a404 response is encountered for the requestwww.example.com/current_events/, the pathMatcher's policy takes effect. If however, the request forwww.example.com/coming_soon/ encounters a 404, the policy in PathRule.customErrorResponsePolicy takes effect. If any of the requests in this example encounter a 500 error code, the policy atUrlMap.defaultCustomErrorResponsePolicy takes effect.
customErrorResponsePolicy is supported only for global external Application Load Balancers.
Implementation
CustomErrorResponsePolicy? customErrorResponsePolicy;