mirror of https://github.com/OpenVidu/openvidu.git
Fix issue with http when server.ssl.enabled is set to false
parent
f870cbdfa9
commit
bc38874a76
|
@ -1288,8 +1288,10 @@ export class Session extends EventDispatcher {
|
|||
}
|
||||
}
|
||||
|
||||
this.openvidu.wsUri = 'wss://' + url.host + '/openvidu';
|
||||
this.openvidu.httpUri = 'https://' + url.host;
|
||||
const isHttps = token.startsWith("wss://");
|
||||
|
||||
this.openvidu.wsUri = url.protocol + url.host + '/openvidu';
|
||||
this.openvidu.httpUri = (isHttps ? 'https://': 'http://') + url.host;
|
||||
|
||||
} else {
|
||||
logger.error('Token "' + token + '" is not valid')
|
||||
|
|
|
@ -565,9 +565,15 @@ public class OpenviduConfig {
|
|||
this.configProps.remove("OPENVIDU_DOMAIN_OR_PUBLIC_IP");
|
||||
}
|
||||
|
||||
String sslEnabled = getValue("server.ssl.enabled");
|
||||
if(sslEnabled == null){
|
||||
sslEnabled = getValue("SERVER_SSL_ENABLED");
|
||||
}
|
||||
String prefix = sslEnabled.equalsIgnoreCase("false") ? "http://": "https://";
|
||||
|
||||
if (domain != null && !domain.isEmpty()) {
|
||||
this.domainOrPublicIp = domain;
|
||||
this.openviduPublicUrl = "https://" + domain;
|
||||
this.openviduPublicUrl = prefix + domain;
|
||||
if (this.httpsPort != null && this.httpsPort != 443) {
|
||||
this.openviduPublicUrl += (":" + this.httpsPort);
|
||||
}
|
||||
|
@ -619,7 +625,7 @@ public class OpenviduConfig {
|
|||
if (publicUrl.startsWith("https://")) {
|
||||
OpenViduServer.wsUrl = publicUrl.replace("https://", "wss://");
|
||||
} else if (publicUrl.startsWith("http://")) {
|
||||
OpenViduServer.wsUrl = publicUrl.replace("http://", "wss://");
|
||||
OpenViduServer.wsUrl = publicUrl.replace("http://", "ws://");
|
||||
}
|
||||
if (OpenViduServer.wsUrl.endsWith("/")) {
|
||||
OpenViduServer.wsUrl = OpenViduServer.wsUrl.substring(0, OpenViduServer.wsUrl.length() - 1);
|
||||
|
|
Loading…
Reference in New Issue