flagger icon indicating copy to clipboard operation
flagger copied to clipboard

Add response header on a per destination basis

Open ConnorGraham opened this issue 3 years ago • 1 comments

I'm trying to define add a http response header to a request only when it is routed through my -canary service.

I'm using Istio.

I found I can add this to my Canary object

headers:
  response:
    add:
      x-is-canary: "true"

but this adds it to all the routes of my VirtualService

  http:
    - headers:
        response:
          add:
            x-is-canary: 'true'
      match:
        - headers:
            canarymvp:
              regex: custom
      route:
        - destination:
            host: canarymvp-primary
          weight: 0
        - destination:
            host: canarymvp-canary
          weight: 100
    - headers:
        response:
          add:
            x-is-canary: 'true'
      route:
        - destination:
            host: canarymvp-primary
          weight: 0

I want this header to only exist on requests going to my canarymvp-canary Service

- destination:
        host: canarymvp-canary
   headers:
        response:
          add:
            x-is-canary: 'true'

ConnorGraham avatar Mar 04 '21 15:03 ConnorGraham

👍 any solution? (can the canary vs primary legs of the VS flagger creates be customized, something like

a service-primary: and a service-secondary: section that can be customized in canary.yaml

I guess the alternative is delegation?)

ldemailly avatar Mar 14 '22 23:03 ldemailly