Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Allow automation CORS origin override (#1160)

Graham Neubigfe26cfa2e46a
diff --git a/scripts/dev-with-automation.mjs b/scripts/dev-with-automation.mjs
index 50661eb043..1e712625b0 100644
--- a/scripts/dev-with-automation.mjs
+++ b/scripts/dev-with-automation.mjs
@@ -796,8 +796,10 @@ function startAutomationBackend(config) {
join(config.stateDir, "workspaces"),
// Session API key for self-hosted auth β€” shared with agent-server via X-Session-API-Key header
AUTOMATION_LOCAL_API_KEY: config.sessionApiKey,
- // CORS: allow localhost origins for dev
- AUTOMATION_CORS_ORIGINS: `http://localhost:${config.ingressPort},http://127.0.0.1:${config.ingressPort},http://localhost:3001,http://127.0.0.1:3001`,
+ // CORS: allow localhost origins for dev, unless explicitly overridden.
+ AUTOMATION_CORS_ORIGINS:
+ process.env.AUTOMATION_CORS_ORIGINS ||
+ `http://localhost:${config.ingressPort},http://127.0.0.1:${config.ingressPort},http://localhost:3001,http://127.0.0.1:3001`,
FILE_STORE: "local",
LOCAL_STORAGE_PATH: join(config.stateDir, "storage"),
OPENHANDS_SUPPRESS_BANNER: "1",