Let the browser reach the ports an execution is actually given

The allowlist still named the shared service's fixed 5173, from before the dev
server handed a port per execution. Every preview would have started on a port
the browser was not allowed to open, and the failure would have read as a broken
application rather than as a refused origin - the kind of mismatch that is found
by exhausting the other explanations first.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lucio Lelii 2026-09-22 11:59:05 +02:00
parent 0e6b400441
commit b76642a09b
2 changed files with 5 additions and 2 deletions

View File

@ -130,7 +130,10 @@ services:
context: ./browser-mcp
environment:
BROWSER_MCP_API_KEYS: ${BROWSER_MCP_API_KEYS}
BROWSER_MCP_ALLOWED_ORIGINS: ${BROWSER_MCP_ALLOWED_ORIGINS:-http://dev-server-worker:5173}
# Both: the shared service's fixed port, and the range the per-execution ones are given.
# Keep the range aligned with DEV_SERVER_PORT_RANGE or a preview starts on a port the
# browser is not allowed to open - which reads as a broken app, not as a refused origin.
BROWSER_MCP_ALLOWED_ORIGINS: ${BROWSER_MCP_ALLOWED_ORIGINS:-http://dev-server-worker:5173,http://dev-server-worker:5200-5219}
BROWSER_MCP_MAX_SESSIONS: ${BROWSER_MCP_MAX_SESSIONS:-8}
user: "1000:1000"
read_only: true

View File

@ -23,7 +23,7 @@ DEV_SERVER_MAX_INSTANCES=4
# Every port an execution can be given has to be reachable by the browser, and the allowlist is by
# exact origin - so the range is spelled out here. Keep it aligned with DEV_SERVER_PORT_RANGE.
BROWSER_MCP_ALLOWED_ORIGINS=http://dev-server-worker:5200-5219
BROWSER_MCP_ALLOWED_ORIGINS=http://dev-server-worker:5173,http://dev-server-worker:5200-5219
CODING_AGENT_MCP_PORT=3101
DEV_SERVER_MCP_PORT=3102