Documentation
¶
Overview ¶
Package cors implements CORS header handling for the Agent Protocol HTTP surface: a browser-based frontend on a different origin -- the common case, e.g. a Vite/React dev server on its own port -- cannot reach the control plane at all without this; the browser blocks the request client-side before it ever reaches application logic, which looks nothing like an auth or network error. Opt-in via langgraph.json's "cors" section, same convention as every other platform extension -- disabled (zero overhead, no headers added) unless configured, correct default for server-to-server or same-origin deployments.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Middleware ¶
Middleware adds CORS headers and answers preflight OPTIONS requests directly, before the request reaches auth or any handler -- a preflight carries no Authorization header by design (that's the whole point of a preflight: the browser checks permission before sending the real, possibly-credentialed request), so it must never be routed through auth.Middleware or it always fails.
func ParseAllowOrigins ¶
ParseAllowOrigins trims whitespace from each configured origin -- forgiving of a trailing comma/space typo in langgraph.json, since a silently-mismatched origin string produces the same confusing "blocked by CORS, no error message" symptom as leaving it unconfigured.