title: cookie-based virtual service routing does not work
body: <p>We followed the instructions in the <a href="https://istio-releases.github.io/v0.1/docs/concepts/traffic-management/rules-configuration.html" rel="nofollow noreferrer">Istio Rules Configuration docs</a> to setup routing rule based on a cookie.</p>
  <p>There is the actual istio virtual service configuration:</p>
  <pre><code>apiVersion: networking.istio.io/v1beta1
  kind: VirtualService
  metadata:
    annotations:
      meta.helm.sh/release-name: prodstagingistio
      meta.helm.sh/release-namespace: istio-system
    creationTimestamp: &quot;2022-07-14T16:12:56Z&quot;
    generation: 22
    labels:
      app.kubernetes.io/managed-by: Helm
    name: api-gateway-virtualservice
    namespace: istio-system
    resourceVersion: &quot;149056406&quot;
    uid: a5be0a58-6fd8-467c-9a98-5de9ac71b1dd
  spec:
    gateways:
    - api-gateway
    hosts:
    - api0-prod.dev.domain.com
    - api0-staging.dev.domain.com
    http:
    - match:
      - authority:
          exact: api0-prod.dev.domain.com
        headers:
          cookie:
            regex: ^(.*;.)?(feature-b=true)(;.*)?$
      route:
      - destination:
          host: api-gateway.blue.svc.cluster.local
    - match:
      - authority:
          exact: api0-prod.dev.domain.com
      route:
      - destination:
          host: api-gateway.green.svc.cluster.local
    - match:
      - authority:
          exact: api0-staging.dev.domain.com
      route:
      - destination:
          host: api-gateway.orange.svc.cluster.local
  </code></pre>
  <p>Supposedly, when accessing <a href="https://api0-prod.dev.domain.com" rel="nofollow noreferrer">https://api0-prod.dev.domain.com</a> with cookie value (feature-b=true) in http header, the traffic should be redirected to api-gateway.blue.svc.cluster.local. But regardless of the cookie setting, the traffic was sent to api-gateway.green.svc.cluster.local.</p>
  <p>But I can't find anything wrong according to the document.</p>
  <p>Can anything help taking a look of the config and see why the cookie setting doesn't work?</p>