From 5c6a28464bad138ff84f1d9a3414963d4b7c236f Mon Sep 17 00:00:00 2001 From: iugastefan922 <30867395+iugastefan922@users.noreply.github.com> Date: Fri, 17 Sep 2021 00:23:27 +0300 Subject: [PATCH] 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 2d196ffba343f0f906c6a39d5cb27a7d06e51602. * added another documentation example --- docs/examples/customization/custom-headers/README.md | 10 +++++++++- .../custom-headers/configmap-client-response.yaml | 10 ++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 docs/examples/customization/custom-headers/configmap-client-response.yaml diff --git a/docs/examples/customization/custom-headers/README.md b/docs/examples/customization/custom-headers/README.md index ac43499e9..378f2aa87 100644 --- a/docs/examples/customization/custom-headers/README.md +++ b/docs/examples/customization/custom-headers/README.md @@ -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` \ No newline at end of file diff --git a/docs/examples/customization/custom-headers/configmap-client-response.yaml b/docs/examples/customization/custom-headers/configmap-client-response.yaml new file mode 100644 index 000000000..3213de3f2 --- /dev/null +++ b/docs/examples/customization/custom-headers/configmap-client-response.yaml @@ -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 \ No newline at end of file