additional info for the custom-headers documentation page (#7603)

* added another documentation example

* added end of file newline

* Revert "added end of file newline"

This reverts commit 2d196ffba3.

* added another documentation example
This commit is contained in:
iugastefan922 2021-09-17 00:23:27 +03:00 committed by GitHub
parent 260910c0a0
commit 5c6a28464b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View file

@ -18,7 +18,15 @@ kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main
The nginx ingress controller will read the `ingress-nginx/ingress-nginx-controller` ConfigMap, find the `proxy-set-headers` key, read HTTP headers from the `ingress-nginx/custom-headers` ConfigMap, and include those HTTP headers in all requests flowing from nginx to the backends.
The above example was for passing a custom list of headers to the upstream server.
To pass the custom headers before sending response traffic to the client, use the add-headers key:
```console
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/docs/examples/customization/custom-headers/configmap-client-response.yaml
```
## Test
Check the contents of the ConfigMaps are present in the nginx.conf file using:
`kubectl exec ingress-nginx-controller-873061567-4n3k2 -n ingress-nginx -- cat /etc/nginx/nginx.conf`
`kubectl exec ingress-nginx-controller-873061567-4n3k2 -n ingress-nginx -- cat /etc/nginx/nginx.conf`

View file

@ -0,0 +1,10 @@
apiVersion: v1
data:
add-headers: "ingress-nginx/custom-headers"
kind: ConfigMap
metadata:
name: ingress-nginx-controller
namespace: ingress-nginx
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx