Pass cookie downstream through ingress controller (cookie blocked)

5/23/2019

I am trying to pass an authentication cookie from a load balancer (outside the cluster) through an ingress controller to a backend service. However, the ingress is not forwarding cookies. I tried all tricks in the documentation for ingress and config map. How do I get the ingress to forward cookies it receives from upstream servers?

Kubernetes GitVersion 1.10.4

Ingress

{
  "kind": "Ingress",
  "apiVersion": "extensions/v1beta1",
  "metadata": {
    "name": "Xspace-ingress",
    "namespace": "Xspace",
    "selfLink": "/apis/extensions/v1beta1/namespaces/Xspace/ingresses/Xspace-ingress",
    "annotations": {
      "nginx.ingress.kubernetes.io/affinity": "cookie",
      "nginx.ingress.kubernetes.io/allow-http": "true",
      "nginx.ingress.kubernetes.io/rewrite-target": "/",
      "nginx.ingress.kubernetes.io/session-cookie-hash": "sha1",
      "nginx.ingress.kubernetes.io/session-cookie-name": "cc-cookiemonster",
      "nginx.ingress.kubernetes.io/ssl-passthrough": "false",
      "nginx.ingress.kubernetes.io/ssl-redirect": "false"
    }
  },
  "spec": {
    "rules": [
      {
        "host": "sample.com",
        "http": {
          "paths": [
            {
              "backend": {
                "serviceName": "Xsvc",
                "servicePort": 8080
              }
            }
          ]
        }
      }
    ]
  },
  "status": {
    "loadBalancer": {
      "ingress": [
        {}
      ]
    }
  }
}

Config Map

{
  "kind": "ConfigMap",
  "apiVersion": "v1",
  "metadata": {
    "name": "nginx-ingress-controller",
    "namespace": "Xspace",
    "selfLink": "/api/v1/namespaces/Xspace/configmaps/nginx-ingress-controller",
    "labels": {
      "app": "nginx-ingress"
    }
  },
  "data": {
    "allow-backend-server-header": "true",
    "enable-underscores-in-headers": "true",
    "enable-vts-status": "false",
    "ignore-invalid-headers": "false",
    "proxy-add-original-uri-header": "true",
    "use-forwarded-headers": "true",
    "worker-processes": "3"
  }
}
-- Dale Kube
kubernetes
kubernetes-ingress
nginx-ingress

0 Answers