Skip to content

Commit 9f8c6f1

Browse files
committed
fix: don't add port to endpoint if domain
1 parent f07c022 commit 9f8c6f1

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

frontend/src/utils/sfu-client.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,12 @@ class SFUClient {
9696
this.sfuPort = sfu_port;
9797

9898
let sfuEndpoint;
99-
try {
100-
const urlObj = new URL(sfu_url);
101-
const defaultPort = urlObj.protocol === "https:" ? "443" : "80";
102-
// If port is empty/null OR matches default for the scheme, omit.
103-
if (!sfu_port || String(sfu_port) === defaultPort) {
104-
sfuEndpoint = urlObj.origin;
105-
} else {
106-
sfuEndpoint = `${urlObj.protocol}//${urlObj.hostname}:${sfu_port}`;
107-
}
108-
} catch (e) {
109-
sfuEndpoint = sfu_port ? `${sfu_url}:${sfu_port}` : sfu_url;
99+
const urlObj = new URL(sfu_url);
100+
const isSecured = urlObj.protocol === "https:";
101+
if (isSecured) {
102+
sfuEndpoint = urlObj.origin;
103+
} else {
104+
sfuEndpoint = `${urlObj.protocol}//${urlObj.hostname}:${sfu_port}`;
110105
}
111106

112107
try {

0 commit comments

Comments
 (0)