Remove header operation

#1

Greetings,

Based on these

I’m trying to remove a response header so I have defined my VirtualService as:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: k8snode-virtual-service
spec:
  hosts:
  - "example.com"
  gateways:
  - k8snode-gateway
  http:
    headers:
      response:
        remove:
          - "x-my-fault-source"
  - route:
    - destination:
        host: k8snode-service
        subset: version-1

But running into,

$ kubectl apply -f headers-manipulation-vs.yaml
error: error parsing headers-manipulation-vs.yaml: error converting YAML to JSON: yaml: line 12: did not find expected key

Based to the above validation error, “response” is the culprit. However, https://istio.io/docs/reference/config/networking/v1alpha3/virtual-service/#Headers says otherwise. Maybe I’m missing something.

Currently, I’m using Istio 1.1 and I tried on v1.1.1 as well and facing the same issue.

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.0", GitCommit:"91e7b4fd31fcd3d5f436da26c980becec37ceefe", GitTreeState:"clean", BuildDate:"2018-06-27T22:29:25Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.7-gke.12", GitCommit:"06f08e60069231bd21bdf673cf0595aac80b99f6", GitTreeState:"clean", BuildDate:"2019-02-25T20:37:10Z", GoVersion:"go1.10.8b4", Compiler:"gc", Platform:"linux/amd64"}

Any pointer will be greatly appreciated. Thank you!

0 Likes

#2

No worries, I was able to make it work with the below change

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: k8snode-virtual-service
spec:
  hosts:
  - "example.com"
  gateways:
  - k8snode-gateway
  http:
  - headers:
      response:
        remove:
          - "x-my-fault-source"
    route:
      - destination:
          host: k8snode-service
          subset: version-1
  - route:
    - destination:
        host: k8snode-service
        subset: version-1
0 Likes