From 4b8d2d5c1deaff23c9e94c76d1db3fafdfa33619 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 1 Jun 2026 11:37:06 +0200 Subject: [PATCH] :bug: Fix problem with shadow-cljs websocket connection --- docker/devenv/defaults.env | 1 + docker/devenv/files/nginx.conf | 7 +++++++ frontend/shadow-cljs.edn | 6 ++++-- manage.sh | 4 ++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docker/devenv/defaults.env b/docker/devenv/defaults.env index 2af19fbcbf..a9fd8a94c2 100644 --- a/docker/devenv/defaults.env +++ b/docker/devenv/defaults.env @@ -48,6 +48,7 @@ AWS_SECRET_ACCESS_KEY=penpot-devenv # PENPOT_PUBLIC_HTTP_PORT. Container-internal ports remain fixed; per-instance # overlays may offset these host-side values. PENPOT_PUBLIC_HTTP_PORT=3449 +SHADOW_SERVER_URL=wss://localhost:3449 PENPOT_MCP_SERVER_PORT=4401 PENPOT_MCP_REPL_PORT=4403 diff --git a/docker/devenv/files/nginx.conf b/docker/devenv/files/nginx.conf index 5847e6551a..ce5566079f 100644 --- a/docker/devenv/files/nginx.conf +++ b/docker/devenv/files/nginx.conf @@ -136,6 +136,13 @@ http { proxy_http_version 1.1; } + location /api/remote-relay { + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_pass http://127.0.0.1:3448; + proxy_http_version 1.1; + } + location /mcp/ws { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; diff --git a/frontend/shadow-cljs.edn b/frontend/shadow-cljs.edn index fadcb4131f..f596a34e19 100644 --- a/frontend/shadow-cljs.edn +++ b/frontend/shadow-cljs.edn @@ -10,7 +10,8 @@ :output-dir "resources/public/js/" :asset-path "/js" :devtools {:watch-dir "resources/public" - :reload-strategy :full} + :reload-strategy :full + :server-url #shadow/env ["SHADOW_SERVER_URL" :default ""]} :build-options {:manifest-name "manifest.json"} :modules {:shared @@ -86,7 +87,8 @@ {:target :browser :output-dir "resources/public/js/worker/" :asset-path "/js/worker" - :devtools {:browser-inject :main + :devtools {:server-url #shadow/env ["SHADOW_SERVER_URL" :default ""] + :browser-inject :main :watch-dir "resources/public" :reload-strategy :full} :build-options {:manifest-name "manifest.json"} diff --git a/manage.sh b/manage.sh index b46ef260ee..a5e8ac6101 100755 --- a/manage.sh +++ b/manage.sh @@ -331,6 +331,10 @@ SERENA_DASHBOARD_EXTERNAL_PORT=${serena_dash} # to a single Valkey Pub/Sub. See mem:devenv/core. PENPOT_BACKEND_WORKER=false +# shadow-cljs relay proxied through nginx so the browser can reach it without +# a separate published port. URL must match the instance's public HTTPS port. +SHADOW_SERVER_URL=wss://localhost:${public} + # Workspace bind mount (computed in manage.sh too, but recorded here for # clarity when inspecting the env file). PENPOT_SOURCE_PATH=${workspace}