Updated on 2025-04-25 GMT+08:00

Header Control

Header control allows you to flexibly add, modify, and delete specified HTTP headers to manage request contents in a non-invasive way. Currently, such header operations can be performed only on routes.

Configure the YAML file as follows:

apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: reviews-route
spec:
  hosts:
  - reviews.prod.svc.cluster.local
  http:                  # Modify specified HTTP headers.
  - headers:
      request:
        set:
          test: "true"
    route:
    - destination:
        host: reviews.prod.svc.cluster.local
        subset: v2
      weight: 25
    - destination:
        host: reviews.prod.svc.cluster.local
        subset: v1
      headers:
        response:
          remove:
          - foo
      weight: 75

You can configure the parameters based on site requirements.