For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.
Header manipulation
Verified Code examples on this page have been automatically tested and verified.Add, set, or remove HTTP request and response headers.
llm or mcp modes, the examples on this page show each option in tabs. For more information, see Routing-based configuration.There are a few different policies that offer manipulation of HTTP requests and responses.
The requestHeaderModifier and responseHeaderModifier modify request and response headers respectively.
These allow you to add, set, or remove headers.
add and set differ in the case the header already exists; set will replace it while add will append.
# yaml-language-server: $schema=https://agentgateway.dev/schema/config
mcp:
port: 3000
policies:
requestHeaderModifier:
add:
x-req-added: value
remove:
- x-remove-me
targets:
- name: everything
stdio:
cmd: npx
args: ["@modelcontextprotocol/server-everything"]More advanced operations are available with the transformation policy.
Like the HeaderModifier policies, this can also add, set, or remove headers, but can also manipulate HTTP bodies.
Additionally, each modification is based on a CEL expression rather than static strings.