Header control

Modify the headers of HTTP requests and responses.

Configuration options

You can modify headers in kgateway using three options:

  1. HTTPRoute, after route selection For the native way in Kubernetes Gateway API, configure a header modifier filter in the HTTPRoute. You can choose to apply the header modifier filter to all the routes that are defined in the HTTPRoute, or to a selection of backendRefs. This route-level policy takes precedence over any TrafficPolicy that you might configure. For more information, see the Kubernetes Gateway API docs.
  2. TrafficPolicy, after route selection: For more flexibility to reuse the header modifier filter across HTTPRoutes, specific routes and Gateways, configure a header modifier filter in the TrafficPolicy. You can attach a TrafficPolicy to a Gateway, all HTTPRoutes via targetRefs, or an individual route via extensionRef. To attach to a backendRef, use a header modifier filter in the HTTPRoute instead. For more information about attachment and merging rules, see the TrafficPolicy concept docs.
  3. ListenerPolicy, before route selection: Perform early request header modification before route selection with a ListenerPolicy. This way, headers cannot influence routing or downstream policy evaluation.

Guides