Skip to content
GitHub Get Started
Reference

CORS Configuration

When calling the Sandbox Agent server from a browser, CORS (Cross-Origin Resource Sharing) controls which origins can make requests.

By default, no CORS origins are allowed. You must explicitly specify origins for browser-based applications:

Terminal window
sandbox-agent server \
--cors-allow-origin "http://localhost:5173"
FlagDescription
--cors-allow-originOrigins to allow
--cors-allow-methodHTTP methods to allow (defaults to all if not specified)
--cors-allow-headerHeaders to allow (defaults to all if not specified)
--cors-allow-credentialsAllow credentials (cookies, authorization headers)

Specify the flag multiple times to allow multiple origins:

Terminal window
sandbox-agent server \
--cors-allow-origin "http://localhost:5173" \
--cors-allow-origin "http://localhost:3000"

By default, all methods and headers are allowed. To restrict them:

Terminal window
sandbox-agent server \
--cors-allow-origin "https://your-app.com" \
--cors-allow-method "GET" \
--cors-allow-method "POST" \
--cors-allow-header "Authorization" \
--cors-allow-header "Content-Type" \
--cors-allow-credentials