Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

chore: cleanup proxy-middleware cleanup logic (#4717)

Myles Scolnick3811dc41d811
diff --git a/marimo/_server/api/middleware.py b/marimo/_server/api/middleware.py
index a22aa84125..9e194c1e9f 100644
--- a/marimo/_server/api/middleware.py
+++ b/marimo/_server/api/middleware.py
@@ -360,11 +360,10 @@ class ProxyMiddleware:
if self.path_rewrite:
ws_path = self.path_rewrite(ws_path)
ws_url = urljoin(ws_target_url, ws_path)
- scheme = urlparse(ws_url).scheme
- if scheme in ("http", "ws"):
+ if ws_url.startswith("http"):
+ # http -> ws
+ # https -> wss
ws_url = ws_url.replace("http", "ws", 1)
- elif scheme in ("https", "wss"):
- ws_url = ws_url.replace("https", "wss", 1)
LOGGER.debug(f"Creating websocket proxy for {ws_url}")
try: