Module addRequestHeader
kotsikau/addRequestHeader
1.0.0
addRequestHeader mediation policy
This Ballerina mediation policy adds a configured HTTP header to every outbound backend request in a request flow.
What it does
- Reads
headerNameandheaderValuepolicy parameters. - Fails fast when
headerNameis missing or empty. - Overwrites any existing request header with the same name.
- Does not log the header value.
Policy parameters
headerNameheaderValue
Both parameters can be provided directly or through deploy-time variables or secrets, for example:
${CUSTOM_HEADER_NAME}${CUSTOM_HEADER_VALUE}
Build and publish
From the project root:
bal pack bal push
Attach in Bijira/API Platform Console
- Open the API proxy.
- Go to
Develop->Policies. - Attach
addRequestHeaderto theRequestflow. - Configure
headerNameandheaderValue.
Notes
- This policy is request-flow only.
- No Java mediator, Redis, or external service is required.
Import
import kotsikau/addRequestHeader;Other versions
1.0.0