Reference for the CORS policy — Cross-Origin Resource Sharing header management and preflight handling.
The cors policy handles CORS preflight requests and appends configured CORS headers to applicable responses. This is required when MCP clients running in browsers (such as web-based AI agents) need to call Agentgateway from a different origin.cors is configured under binds[].listeners[].routes[].policies:
List of request headers that browsers are permitted to send in cross-origin requests. Set in the Access-Control-Allow-Headers response header.Common headers to include for MCP:
When true, includes Access-Control-Allow-Credentials: true in CORS responses. Required when the browser needs to send cookies or Authorization headers with cross-origin requests.
Do not combine allowCredentials: true with allowOrigins: ['*']. Browsers reject credentialed requests when the allowed origin is a wildcard.
List of response headers that browsers are permitted to access in JavaScript. Set in the Access-Control-Expose-Headers response header.For MCP, expose the session header so clients can track their session:
How long (in seconds) browsers may cache the preflight response. Reduces the number of preflight requests sent by browsers. Set in the Access-Control-Max-Age response header.
Agentgateway automatically handles CORS preflight (OPTIONS) requests and appends the configured headers to all applicable responses. You do not need to configure a separate route for OPTIONS requests.