<p>I'm having a problem where my kubernetes nginx ingress controller is <strong>NOT</strong> forwarding the headers with underscores in them.</p>
<p>I created a configMap with name <code>my-release-ingress-nginx-controller</code> with the following entry.</p>
<pre><code>    enable-underscores-in-headers: &quot;true&quot;
</code></pre>
<p>After this i checked the nginx.conf file by describing the nginx ingress controller pod, using this command <code>kubectl exec -it my-release-ingress-nginx-controller-d7648bcc8-6lfxv cat nginx.conf</code>. There i found this <code>underscores_in_headers on;</code>. Even after this toggle, the nginx is still not forwarding the headers with underscores in it.</p>
<p>ConfigMap:</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: my-release-ingress-nginx-controller
  namespace: default
data:
  enable-underscores-in-headers: &quot;true&quot;
  ignore-invalid-headers: &quot;false&quot;
</code></pre>
<p>ConfigMap describe:</p>
<pre><code>Name:         my-release-ingress-nginx-controller
Namespace:    default
Labels:       &lt;none&gt;
Annotations:  
Data
====
enable-underscores-in-headers:
----
true
ignore-invalid-headers:
----
false
Events:
  Type    Reason  Age   From                      Message
  ----    ------  ----  ----                      -------
  Normal  CREATE  27s   nginx-ingress-controller  ConfigMap default/my-release-ingress-nginx-controller
</code></pre>
<p>Deployment describe</p>
<pre><code>Args:
  /nginx-ingress-controller
  --publish-service=default/my-release-ingress-nginx-controller
  --election-id=ingress-controller-leader
  --ingress-class=nginx
  --configmap=default/my-release-ingress-nginx-controller
</code></pre>
<p>Ingress describe:</p>
<pre><code>Name:             ingress-resource-1
Namespace:        default
Address:          172.31.14.220
Default backend:  default-http-backend:80 (&lt;error: endpoints &quot;default-http-backend&quot; not found&gt;)
Rules:
  Host                                               Path  Backends
  ----                                               ----  --------
  api.dev.com  
                                                     /   faq-dev:10013 (172.17.0.3:10013)
Annotations:                                         kubernetes.io/ingress.class: nginx
                                                     nginx.ingress.kubernetes.io/rewrite-target: /
Events:
  Type    Reason  Age                     From                      Message
  ----    ------  ----                    ----                      -------
  Normal  UPDATE  3m10s (x2443 over 20h)  nginx-ingress-controller  Ingress default/ingress-resource-1
  Normal  UPDATE  2m10s (x2483 over 20h)  nginx-ingress-controller  Ingress default/ingress-resource-1
</code></pre>
<p>PS: I have setup a single node kubernetes cluster using minikube , inside an AWS ec2 server. Also the ingress is configured as a deployment and not a daemonset.The ingress configured is the kubernetes one from this repository - <a href="https://github.com/kubernetes/ingress-nginx" rel="nofollow noreferrer">https://github.com/kubernetes/ingress-nginx</a></p>

<p>Try this Please</p>
<pre><code>apiVersion: v1
kind: ConfigMap
data:
  enable-underscores-in-headers: &quot;true&quot;
  ignore-invalid-headers: &quot;false&quot;
metadata:
  name: nginx-configuration
  namespace: default
</code></pre>
<p>and include the same in nginx-ingress-controller-deployment</p>
<pre><code>containers:
  - name: nginx-ingress-controller
    image: &lt;YOUR NGINX INGRSS IMAGE_NAME&gt;
    args:
      - /nginx-ingress-controller
      - --configmap=$(POD_NAMESPACE)/nginx-configuration
    env:
      - name: POD_NAME
        valueFrom:
          fieldRef:
            fieldPath: metadata.name
      - name: POD_NAMESPACE
        valueFrom:
          fieldRef:
            fieldPath: metadata.namespace
</code></pre>
