| author | |
| committer | |
| log | 6271b989bc72a255483aa96ccb2868ef4655341d |
| tree | a00e0977aca59ebff770a4c74ec04ec1f55ec5cb |
| parent | 57aa6bf16cd0dcfbe9037a5ca29ad61bdd2a857e |
| signature | Signed by PGP key B5690EEEBB952194 |
When T3 Code web mode is accessed via HTTPS (e.g. through a reverse proxy
or Tailscale Serve), the WebSocket connection must use wss:// instead of
ws://. Browsers block mixed content — an insecure ws:// connection
initiated from an HTTPS page.
Fix: derive the WebSocket protocol from window.location.protocol.
Co-authored-by: PatrickBauer <patrick@patrickbauer.dev>2 files changed, 2 insertions(+), 2 deletions(-)
apps/web/src/components/Sidebar.tsx+1-1| ... | ... | @@ -225,7 +225,7 @@ function getServerHttpOrigin(): string { |
| 225 | 225 | ? bridgeUrl |
| 226 | 226 | : envUrl && envUrl.length > 0 |
| 227 | 227 | ? envUrl |
| 228 | : `ws://${window.location.hostname}:${window.location.port}`; | |
| 228 | : `${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.hostname}:${window.location.port}`; | |
| 229 | 229 | // Parse to extract just the origin, dropping path/query (e.g. ?token=…) |
| 230 | 230 | const httpUrl = wsUrl.replace(/^wss:/, "https:").replace(/^ws:/, "http:"); |
| 231 | 231 | try { |
apps/web/src/wsTransport.ts+1-1| ... | ... | @@ -44,7 +44,7 @@ export class WsTransport { |
| 44 | 44 | ? bridgeUrl |
| 45 | 45 | : envUrl && envUrl.length > 0 |
| 46 | 46 | ? envUrl |
| 47 | : `ws://${window.location.hostname}:${window.location.port}`); | |
| 47 | : `${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.hostname}:${window.location.port}`); | |
| 48 | 48 | this.connect(); |
| 49 | 49 | } |
| 50 | 50 |