Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): use wss:// when page is served over HTTPS #391

MergedPatrickBauer(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/391/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 2 changed files with 2 additions and 2 deletions.

x
0 of 2 viewed, 2 left
1 addition and 1 deletionapps/web/src/components/Sidebar.tsxModified
View file
@@ -225,7 +225,7 @@
? bridgeUrl
: envUrl && envUrl.length > 0
? envUrl
- : `ws://${window.location.hostname}:${window.location.port}`;
+ : `${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.hostname}:${window.location.port}`;
// Parse to extract just the origin, dropping path/query (e.g. ?token=…)
const httpUrl = wsUrl.replace(/^wss:/, "https:").replace(/^ws:/, "http:");
try {
1 addition and 1 deletionapps/web/src/wsTransport.tsModified
View file
@@ -44,7 +44,7 @@
? bridgeUrl
: envUrl && envUrl.length > 0
? envUrl
- : `ws://${window.location.hostname}:${window.location.port}`);
+ : `${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.hostname}:${window.location.port}`);
this.connect();
​