</code></pre></div><p><ahref=configmap.yaml>configmap.yaml</a> defines a ConfigMap in the <code>ingress-nginx</code> namespace named <code>ingress-nginx-controller</code>. This controls the <ahref=../../../user-guide/nginx-configuration/configmap/>global configuration</a> of the ingress controller, and already exists in a standard installation. The key <code>proxy-set-headers</code> is set to cite the previously-created <code>ingress-nginx/custom-headers</code> ConfigMap.</p><divclass=highlight><pre><span></span><code><spanclass=go>kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/docs/examples/customization/custom-headers/configmap.yaml</span>
</code></pre></div><p>The Ingress-Nginx Controller will read the <code>ingress-nginx/ingress-nginx-controller</code> ConfigMap, find the <code>proxy-set-headers</code> key, read HTTP headers from the <code>ingress-nginx/custom-headers</code> ConfigMap, and include those HTTP headers in all requests flowing from nginx to the backends.</p><p>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:</p><divclass=highlight><pre><span></span><code><spanclass=go>kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/docs/examples/customization/custom-headers/configmap-client-response.yaml</span>
</code></pre></div><h2id=test>Test<aclass=headerlinkhref=#testtitle="Permanent link"> ¶</a></h2><p>Check the contents of the ConfigMaps are present in the nginx.conf file using: <code>kubectl exec ingress-nginx-controller-873061567-4n3k2 -n ingress-nginx -- cat /etc/nginx/nginx.conf</code></p></article></div></div></main><footerclass=md-footer><divclass="md-footer-meta md-typeset"><divclass="md-footer-meta__inner md-grid"><divclass=md-copyright> Made with <ahref=https://squidfunk.github.io/mkdocs-material/target=_blankrel=noopener> Material for MkDocs </a></div></div></div></footer></div><divclass=md-dialogdata-md-component=dialog><divclass="md-dialog__inner md-typeset"></div></div><scriptid=__configtype=application/json>{"base":"../../..","features":["navigation.tabs","navigation.tabs.sticky","navigation.instant","navigation.sections"],"search":"../../../assets/javascripts/workers/search.f886a092.min.js","translations":{"clipboard.copied":"Copied to clipboard","clipboard.copy":"Copy to clipboard","search.result.more.one":"1 more on this page","search.result.more.other":"# more on this page","search.result.none":"No matching documents","search.result.one":"1 matching document","search.result.other":"# matching documents","search.result.placeholder":"Type to start searching","search.result.term.missing":"Missing","select.version":"Select version"}}</script><scriptsrc=../../../assets/javascripts/bundle.aecac24b.min.js></script></body></html>