Overview
Modify the headers of HTTP requests and responses. For more information, see the Gateway API docs for header filters.
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 EnterpriseKgatewayTrafficPolicy that you might configure. For more information, see the Kubernetes Gateway API docs. - EnterpriseKgatewayTrafficPolicy, 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 EnterpriseKgatewayTrafficPolicy. You can attach a EnterpriseKgatewayTrafficPolicy 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 EnterpriseKgatewayTrafficPolicy 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.