Header control
Modify the headers of HTTP requests and responses.
Configuration options
You can modify headers in kgateway using three options:
- 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. - 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 viaextensionRef. To attach to abackendRef, use a header modifier filter in the HTTPRoute instead. For more information about attachment and merging rules, see the TrafficPolicy concept docs. - 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.