<p>I am using nginx ingress controller and external authentication to route to my application via authorize app. Below is my ingress file:</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: hello-kubernetes-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/auth-url: http://b20bdc2b8916.ngrok.io/authorize
    nginx.ingress.kubernetes.io/auth-method: POST
spec:
  rules:
  - host: hw1.yourdomain
    http:
      paths:
      - backend:
          serviceName: hello-kubernetes-first
          servicePort: 80
  - host: hw2.yourdomain
    http:
      paths:
      - backend:
          serviceName: hello-kubernetes-second
          servicePort: 80
~
</code></pre>
<p>The authorized API return response headers(principal-id, app-type) which I want to get from the below command</p>
<pre><code>curl -X GET &quot;http://hw1.yourdomain&quot; -H  &quot;accept: */*&quot; -H  &quot;Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6Ik15dDZzVVd2WWdkS253WHVlVE9XaC0zNVFzdnFRSjk3aDdOTFhVdkt4YUkifQ.eyJpc3MiOiJodHR*****&quot;




  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   668  100   668    0     0     49      0  0:00:13  0:00:13 --:--:--   152HTTP/1.1 200 OK
Date: Tue, 09 Mar 2021 09:35:52 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 668
Connection: keep-alive
X-Powered-By: Express
ETag: W/&quot;29c-/QY+HmD5p/HwK1AOeM+b3H5wbI0&quot;

&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;Hello Kubernetes!&lt;/title&gt;
    &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/css/main.css&quot;&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://fonts.googleapis.com/css?family=Ubuntu:300&quot; &gt;
&lt;/head&gt;
&lt;body&gt;

  &lt;div class=&quot;main&quot;&gt;
    &lt;img src=&quot;/images/kubernetes.png&quot;/&gt;
    &lt;div class=&quot;content&quot;&gt;
      &lt;div id=&quot;message&quot;&gt;
  Hello from the first deployment!
&lt;/div&gt;
&lt;div id=&quot;info&quot;&gt;
  &lt;table&gt;
    &lt;tr&gt;
      &lt;th&gt;pod:&lt;/th&gt;
      &lt;td&gt;hello-kubernetes-first-8477fc565d-gb22w&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;node:&lt;/th&gt;
      &lt;td&gt;Linux (4.19.157)&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;

&lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p>How can I get the response header from the auth-url ?</p>

Divya Vyas
<p>If you are using the custom header Nginx will drop your deader if not following the HTTP header.</p>
<p>It's mainly possible when you are using the <code>_</code> in your headers.</p>
<p>In this case, you can update the Nginx configmap and restart the Nginx PODs to allow and pass the custom headers.</p>
<p>You can open the config map of Nginx and update the configuration.</p>
<pre><code>enable-underscores-in-headers: &quot;true&quot;
</code></pre>
<p>Example Nginx config map</p>
<pre><code>apiVersion: v1
data:
  enable-underscores-in-headers: &quot;true&quot;
kind: ConfigMap
metadata:
  labels:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
  name: nginx-configuration
  namespace: ingress-nginx
</code></pre>
