Adds CustomHTTPErrors ingress annotation and test
Adds per-server/location error-catch functionality to nginx template Adds documentation Reduces template duplication with helper function for CUSTOM_ERRORS data Updates documentation Adds e2e test for customerrors Removes AllCustomHTTPErrors, replaces with template function with deduplication and adds e2e test of deduplication Fixes copy-paste error in test, adds additional test cases Reverts noop change in controller.go (unused now)
This commit is contained in:
parent
1f76acfa6a
commit
0ebf0354cb
9 changed files with 294 additions and 11 deletions
|
|
@ -31,6 +31,7 @@ You can add these Kubernetes annotations to specific Ingress objects to customiz
|
|||
|[nginx.ingress.kubernetes.io/base-url-scheme](#rewrite)|string|
|
||||
|[nginx.ingress.kubernetes.io/client-body-buffer-size](#client-body-buffer-size)|string|
|
||||
|[nginx.ingress.kubernetes.io/configuration-snippet](#configuration-snippet)|string|
|
||||
|[nginx.ingress.kubernetes.io/custom-http-errors](#custom-http-errors)|[]int|
|
||||
|[nginx.ingress.kubernetes.io/default-backend](#default-backend)|string|
|
||||
|[nginx.ingress.kubernetes.io/enable-cors](#enable-cors)|"true" or "false"|
|
||||
|[nginx.ingress.kubernetes.io/cors-allow-origin](#enable-cors)|string|
|
||||
|
|
@ -213,6 +214,17 @@ The ingress controller requires a [default backend](../default-backend.md).
|
|||
This service handles the response when the service in the Ingress rule does not have endpoints.
|
||||
This is a global configuration for the ingress controller. In some cases could be required to return a custom content or format. In this scenario we can use the annotation `nginx.ingress.kubernetes.io/default-backend: <svc name>` to specify a custom default backend.
|
||||
|
||||
### Custom HTTP Errors
|
||||
|
||||
Like the [`custom-http-errors`](../configmap.md#custom-http-errors) value in the ConfigMap, this annotation will set NGINX `proxy-intercept-errors`, but only for the NGINX location associated with this ingress.
|
||||
Different ingresses can specify different sets of error codes. Even if multiple ingress objects share the same hostname, this annotation can be used to intercept different error codes for each ingress (for example, different error codes to be intercepted for different paths on the same hostname, if each path is on a different ingress).
|
||||
If `custom-http-errors` is also specified globally, the error values specified in this annotation will override the global value for the given ingress' hostname and path.
|
||||
|
||||
Example usage:
|
||||
```
|
||||
custom-http-errors: "404,415"
|
||||
```
|
||||
|
||||
### Enable CORS
|
||||
|
||||
To enable Cross-Origin Resource Sharing (CORS) in an Ingress rule, add the annotation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue