Skip to content

Commit e4cf72b

Browse files
cailmdaleyclaude
andcommitted
refactor(web): trim dead Portolan/Tauri CORS origins
The browser UI is served same-origin from :4000, so the Tauri custom-protocol origins (tauri://localhost, http(s)://tauri.localhost) that admitted the bundled Portolan.app are dead. Keep the localhost dev origins the Vite dev server genuinely uses. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016RVNkdUCoxqgGVVhUoApVp
1 parent b6c67c9 commit e4cf72b

1 file changed

Lines changed: 4 additions & 18 deletions

File tree

lib/shuttle_web/cors_plug.ex

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,10 @@ defmodule ShuttleWeb.CORSPlug do
22
@moduledoc """
33
Hand-rolled CORS plug for the Shuttle API endpoints.
44
5-
Allows the portolan kanban to call the daemon (127.0.0.1:4000) directly
6-
from the browser. Covers all endpoints the kanban hits: GET /api/v1/agents
7-
and POST /api/v1/dispatch.
8-
9-
Origin matching is allowlist-based — the dev-server localhost variants
10-
AND the Tauri webview custom-protocol origins are admitted. The Tauri
11-
origins are required because the bundled Portolan.app loads from a
12-
custom protocol (not localhost:5173), so its fetches carry a non-http
13-
Origin that the dev-only allowlist used to reject — manifesting as
14-
"Load failed" / "Couldn't reach the Shuttle daemon" in the kanban modal
15-
despite the daemon actually being up.
5+
The browser UI is served same-origin from :4000, so CORS only matters for
6+
the Vite dev server (and a legacy :3000 fallback) calling the daemon
7+
directly during development. Origin matching is allowlist-based on those
8+
localhost variants.
169
1710
Requests from non-allowed origins pass through without CORS headers
1811
(the browser will block them).
@@ -32,13 +25,6 @@ defmodule ShuttleWeb.CORSPlug do
3225
"http://127.0.0.1:3000",
3326
"http://localhost:5173",
3427
"http://127.0.0.1:5173",
35-
# Bundled Tauri webview custom-protocol origins. macOS/Linux default
36-
# to `tauri://localhost`; Windows (and Tauri 2 with the `tauri.localhost`
37-
# form) uses the http variant. Both are added so the same build runs
38-
# cross-platform without a platform-specific shim.
39-
"tauri://localhost",
40-
"http://tauri.localhost",
41-
"https://tauri.localhost",
4228
]
4329

4430
@allowed_methods "GET, POST, OPTIONS"

0 commit comments

Comments
 (0)