Using Istio 1.34 (bundled with microk8s 1.18.2) I would like to add some custom headers to a http route. These custom headers must be injected to the http request before reaching the service:
- My-Custom-Header1: “abc-123”
- My-Custom-Header2: “[5, 6, 7]”
QUESTION1: Can you please show the correct way to configure the injection of the custom headers. I am confused by the istio documentation HTTPRoute. Contrary to the
match field which accepts an array of
headers field can accept only one value of type Headers. How is it possible to add more than one custome header?
apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: myapp-virtsvc spec: hosts: - "*" gateways: - my-istio-gateway http: - match: - uri: prefix: "/mysvc1/" route: - destination: host: myservice1 port: number: 80 name: "svc1-routes" - match: - uri: prefix: / route: - destination: host: my-main-service port: number: 80 name: "main-svc-routes" headers: request: add: My-Custom-Header1: "abc-123" #---- how to add more custom headers? ----
QUESTION2: Notice in the
VirtualService config above, there are two
match under the
http route. The
headers field definition injects the custom headers for both
match. How to restrict the custom header injection only for
match.name: "main-svc-routes" ?
Thanks in advance for any help