<p>I would like to use some kubernetes ingress (doesn't matter the ingress type) on google cloud  GKE 1.19.7-gke.1302, and nginx ingress deployed by nginx-ingress-0.8.0 helm chart, and my need is to fetch a cookie and use it later to authenticate to our service. When I use nginx as deployment it works, but when I use nginx ingress it seems to ignore the annotation.</p>
<p>I tried using this configuration snippet for the nginx ingress, which works on the nginx deployment but not on the ingress:</p>
<pre><code>nginx.ingress.kubernetes.io/configuration-snippet: |
  proxy_set_header &quot;Authorization&quot; &quot;Basic $cookie_myToken&quot;;  
</code></pre>
<p>And this is my entire ingress yaml:</p>
<pre><code>---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: my-nginx-ingress
  namespace: default
  annotations:
    kubernetes.io/ingress.class: nginx
    # enable backend redirections
    kubernetes.io/tls-acme: &quot;true&quot;
    # enable stickiness
    nginx.ingress.kubernetes.io/affinity: &quot;cookie&quot;
    nginx.ingress.kubernetes.io/session-cookie-name: &quot;route&quot;
    nginx.ingress.kubernetes.io/session-cookie-expires: &quot;172800&quot;
    nginx.ingress.kubernetes.io/session-cookie-max-age: &quot;172800&quot;
    nginx.ingress.kubernetes.io/configuration-snippet: |
      proxy_set_header &quot;Authorization&quot; &quot;Basic $cookie_myToken&quot;;  
spec:
  tls:
  - secretName: my-tls
    hosts: 
    - &quot;test.com&quot;
  defaultBackend:
    service:
      name: my-nodeport
      port:
        number: 80
  rules:
    - host: &quot;test.com&quot;
      http:
        paths:
          - path: /
            pathType: ImplementationSpecific
            backend:
              service:
                name: my-nodeport
                port:
                  number: 80
</code></pre>
<p>Any ideas?</p>

<p>Posting this answer to make it more visible as issue was identified and solved in <code>comment section</code>.</p>
<p>Root cause of this issue was <code>Nginx Ingress Controller</code> misconfiguration.</p>
<p>In the OP's setup <code>Nginx Ingress Controller</code>, <code>v.0.8.0</code> was used. After redeploying <code>Nginx Ingress</code> to latest version (v0.44.0) from <a href="https://kubernetes.github.io/ingress-nginx/deploy/#using-helm" rel="nofollow noreferrer">Nginx Ingress Documentation</a> it started working properly.</p>
<blockquote>
<p>Yes, reinstalling nginx ingress to the latest version with helm solved the problem.</p>
</blockquote>
