Remove Headers
Overview
The Remove Headers policy action enables the removal of headers to both inbound and outbound traffic.
Example
Traffic Policy for removing headers from an incoming request.
- YAML
- JSON
# snippet
---
actions:
- type: "remove-headers"
config:
headers:
- "is-ngrok"
- "internal-trace-id"
// snippet
{
"actions": [
{
"type": "remove-headers",
"config": {
"headers": [
"is-ngrok",
"internal-trace-id"
]
}
}
]
}
Request:
curl -H "is-internal: true" -H "ngrok-trace-id: abc123" https://example.ngrok.app/api/v1
Result:
> GET https://example.ngrok.app/v1 HTTP/2
> date: 2024-06-24T15:30:00Z
Behavior
When executed as an inbound policy, this action will remove headers on an incoming http request before reaching the upstream server with the configured headers. When executed as an outbound policy, the configured headers are removed to the response from the upstream server.
Reference
Supported Directions
- Inbound
- Outbound
Configuration
Type |
---|
remove-headers |
Parameter | Description | |
---|---|---|
headers | Array<string> | Headers to be removed from the request or response. |