Add header Host into mirror annotations (#8178)

This commit is contained in:
serge-r 2022-05-08 07:39:17 +07:00 committed by GitHub
parent ec1b01092e
commit 730b7408ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 62 additions and 2 deletions

View file

@ -131,6 +131,7 @@ You can add these Kubernetes annotations to specific Ingress objects to customiz
|[nginx.ingress.kubernetes.io/modsecurity-snippet](#modsecurity)|string|
|[nginx.ingress.kubernetes.io/mirror-request-body](#mirror)|string|
|[nginx.ingress.kubernetes.io/mirror-target](#mirror)|string|
|[nginx.ingress.kubernetes.io/mirror-host](#mirror)|string|
### Canary
@ -941,6 +942,13 @@ By default the request-body is sent to the mirror backend, but can be turned off
nginx.ingress.kubernetes.io/mirror-request-body: "off"
```
Also by default header Host for mirrored requests will be set the same as a host part of uri in the "mirror-target" annotation. You can override it by "mirror-host" annotation:
```yaml
nginx.ingress.kubernetes.io/mirror-target: https://1.2.3.4/$request_uri
nginx.ingress.kubernetes.io/mirror-host: "test.env.com"
```
**Note:** The mirror directive will be applied to all paths within the ingress resource.
The request sent to the mirror is linked to the original request. If you have a slow mirror backend, then the original request will throttle.