You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
authored and
K. Kaushik Reddy
committed
fix(desktop): allow loopback origins so tunnel connections pass CORS
Connecting to a VM through the SSH tunnel failed with "Request failed with
status code 403" as soon as the user tried to log in.
The tunnel serves the web app from http://127.0.0.1:<sticky port>, not the
VM's hostname, and a self-host deployment that sets CORS_ALLOWED_ORIGINS to
its public hostname replaces the built-in list rather than extending it. Spring
treats any request carrying Origin as cross-origin (the same-origin
short-circuit went away in 5.3), so the backend answered 403 with the
plain-text body "Invalid CORS request". That body has no `message` field, so
client.js's axios interceptor fell through to axios's own wording — an error
naming neither CORS nor the origin.
It hid well: Chromium omits Origin on same-origin GETs, so the health probe,
the SPA and every read succeeded and the connection tested green. Only the
first POST — the login — failed.
- probe.js sends an Origin header, so the rejection is caught at connect time
rather than at the user's first login, and transport.js reports it as
`cors-rejected` naming the origin and the exact allowlist to set.
- Loopback entries in the shipped defaults now carry a port wildcard, since
the tunnel's local port is chosen at runtime. Legal only because
SecurityConfig uses setAllowedOriginPatterns.
- .env.example, docker-compose.yml and desktop/README.md spell out that
CORS_ALLOWED_ORIGINS replaces the list, which is how the loopback entries
go missing.
- CLAUDE.md and config.js drop the "zero backend changes" claim: CORS is the
one setting the thin client does require.
- tunnel-selftest.js grows two checks (14/14) covering the Origin header and
a 403 from an allowlist that omits the origin.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
0 commit comments