The Modify Headers policy can set or remove headers on requests.
Modify Headers
Related Documentation
Incompatible with
on-prem
Tags
Related Resources
Use cases
Common use cases for the Modify Headers policy:
|
Use case |
Description |
|---|---|
| Remove and replace a header | Remove a specific header and replace it with a custom header of your choice. |
| Add a header based on a condition | If a record fits a specific condition, add a custom header of your choice. |
How it works
This policy runs in the produce or consume phase.
For produced messages:
- A Kafka client produces messages and sends them to Event Gateway.
- Event Gateway adjusts the headers before passing messages to the broker.
For consumed messages:
- Event Gateway consumes messages from a Kafka broker.
- Event Gateway adjusts the headers before passing messages to the client.
sequenceDiagram autonumber participant client as Client participant egw as Event Gateway participant broker as Event broker client->>egw: produce message egw->>egw: remove or add headers egw->>broker: send message broker->>egw: consume message egw->>egw: remove or add headers egw->>client: pass message with new headers
Nested policies
This policy can be applied directly to the virtual cluster, or be nested within a Schema Validation policy. See the policy nesting example to learn how to apply a Modify Headers policy to a parent.
Nested policies are sorted into an index. You can re-order nested policies within the parent policy by adjusting this index. See the reference for nested policies for more detail.