title: knative: routing based on custom headers?
body: <p>We can create a knative service which have two revisions, then we can config traffic like this.</p>
  <pre><code> traffic:
    - latestRevision: false
      percent: 100
      revisionName: header-v1
    - latestRevision: false
      percent: 0
      revisionName: header-v2
      tag: v2
  </code></pre>
  <p>We can use header &quot;Knative-Serving-Tag: v2&quot; to route to header-v2 revision.
  However, we want to route to specific revision using custom header, like &quot;User: v2&quot;. What should we do?
  We tried some method. First, we try to edit the corresponding virtualservice, but the new rules will be automatically deleted. Then, we try to add a new virtualservice.</p>
  <pre><code>apiVersion: networking.istio.io/v1beta1
  kind: VirtualService
  metadata:
    name: header-custom-ingress
    namespace: default
  spec:
    gateways:
    - knative-serving/knative-ingress-gateway
    hosts:
    - header-test.default.XXXXXXXXXXXXXXX.io
    http:
    - match:
      - headers:
          User:
            exact: v2
      retries: {}
      rewrite:
        authority: v2-header.default.XXXXXXXXXXXXXXX.io
      route:
      - destination:
          host: istio-ingressgateway.istio-system.svc.cluster.local
          port:
            number: 80
        weight: 100
  
  </code></pre>
  <p>Hosts cannot be the same as the previous one, otherwise it will not take effect. We don't want to change the host, we just want to route through the custom header. What would be the better way to do that? Thanks in advance.</p>