For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.
Rewrites
Verified Code examples on this page have been automatically tested and verified.Modify URL hostnames and paths of incoming requests dynamically.
Attaches to:
llm or mcp modes, the examples on this page show each option in tabs. For more information, see Routing-based configuration.Modify URLs of incoming requests with rewriteRewriteA traffic management feature that modifies the authority (host) or path of requests before forwarding them to backends. policies.
For example, the following configuration modifies the request hostname to example.com and the request path to /new-path.
# yaml-language-server: $schema=https://agentgateway.dev/schema/config
mcp:
port: 3000
policies:
urlRewrite:
authority:
full: example.com
path:
full: /new-path
targets:
- name: everything
stdio:
cmd: npx
args: ["@modelcontextprotocol/server-everything"]