Add override for proxy_intercept_errors when using Custom HTTP Errors (#9497)
* added proxy-intercept-errors config option * fixed error when comparing locations * fixed missing location config from annotation added e2e test * reversed logic for proxy-intercept-errors to disable-proxy-intercept-errors * reversed logic to disable-proxy-intercept-errors * reversed logic * default has to be false * put comment in same line as return * run gofmt * fixing wrong Boilerplate header * updated code to new IngressAnnotation interface * fixes to satisfy PR comments * synced with upstream; fixed typo * gofumpt disableproxyintercepterrors.go * gofumpt
This commit is contained in:
parent
e0446d7554
commit
ad406b64d8
12 changed files with 395 additions and 108 deletions
|
|
@ -50,6 +50,7 @@ You can add these Kubernetes annotations to specific Ingress objects to customiz
|
|||
|[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/disable-proxy-intercept-errors](#disable-proxy-intercept-errors)|"true" or "false"|
|
||||
|[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|
|
||||
|
|
@ -330,6 +331,17 @@ Example usage:
|
|||
nginx.ingress.kubernetes.io/custom-http-errors: "404,415"
|
||||
```
|
||||
|
||||
## Disable Proxy intercept Errors
|
||||
|
||||
Like the [`disable-proxy-intercept-errors`](./configmap.md#disable-proxy-intercept-errors) value in the ConfigMap, this annotation allows to disable NGINX `proxy-intercept-errors` when `custom-http-errors` are set, but only for the NGINX location associated with this ingress. If a [default backend annotation](#default-backend) is specified on the ingress, the errors will be routed to that annotation's default backend service (instead of the global default backend).
|
||||
Different ingresses can specify different sets of errors codes and there are UseCases where NGINX shall not intercept all errors returned from upstream.
|
||||
If `disable-proxy-intercept-errors` is also specified globally, the annotation will override the global value for the given ingress' hostname and path.
|
||||
|
||||
Example usage:
|
||||
```
|
||||
nginx.ingress.kubernetes.io/disable-proxy-intercept-errors: "false"
|
||||
```
|
||||
|
||||
### Default Backend
|
||||
|
||||
This annotation is of the form `nginx.ingress.kubernetes.io/default-backend: <svc name>` to specify a custom default backend. This `<svc name>` is a reference to a service inside of the same namespace in which you are applying this annotation. This annotation overrides the global default backend. In case the service has [multiple ports](https://kubernetes.io/docs/concepts/services-networking/service/#multi-port-services), the first one is the one which will receive the backend traffic.
|
||||
|
|
|
|||
|
|
@ -180,6 +180,7 @@ The following table shows a configuration option's name, type, and the default v
|
|||
|[stream-snippet](#stream-snippet)|string|""||
|
||||
|[location-snippet](#location-snippet)|string|""||
|
||||
|[custom-http-errors](#custom-http-errors)|[]int|[]int{}||
|
||||
|[disable-proxy-intercept-errors](#disable-proxy-intercept-errors)|bool|"false"|
|
||||
|[proxy-body-size](#proxy-body-size)|string|"1m"||
|
||||
|[proxy-connect-timeout](#proxy-connect-timeout)|int|5||
|
||||
|[proxy-read-timeout](#proxy-read-timeout)|int|60||
|
||||
|
|
@ -1128,10 +1129,18 @@ You can not use this to add new locations that proxy to the Kubernetes pods, as
|
|||
|
||||
Enables which HTTP codes should be passed for processing with the [error_page directive](https://nginx.org/en/docs/http/ngx_http_core_module.html#error_page)
|
||||
|
||||
Setting at least one code also enables [proxy_intercept_errors](https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_intercept_errors) which are required to process error_page.
|
||||
Setting at least one code also enables [proxy_intercept_errors](https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_intercept_errors) if not disabled with [disable-proxy-intercept-errors](#disable-proxy-intercept-errors).
|
||||
|
||||
Example usage: `custom-http-errors: 404,415`
|
||||
|
||||
## disable-proxy-intercept-errors
|
||||
|
||||
Allows to disable [proxy-intercept-errors](https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_intercept_errors).
|
||||
|
||||
Disabling [proxy_intercept_errors](https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_intercept_errors) allows to pass upstream errors to client even if [custom-http-errors](#custom-http-errors) are set.
|
||||
|
||||
Example usage: `disable-proxy-intercept-errors: "true"`
|
||||
|
||||
## proxy-body-size
|
||||
|
||||
Sets the maximum allowed size of the client request body.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue