Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit 80250e0

Browse files
authored
Update via host setting to support nginx https access (#611)
1 parent 4521f2b commit 80250e0

File tree

2 files changed

+21
-23
lines changed

2 files changed

+21
-23
lines changed

source/management_api/resource/v1/tokensResource.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,21 +100,25 @@ var generateToken = function (currentRoom, authData, origin, callback) {
100100
return;
101101
}
102102

103-
token.secure = ec.ssl;
104-
if (ec.via_address !== '') {
105-
token.host = ec.via_address;
106-
}
107-
else if (ec.hostname !== '') {
108-
token.host = ec.hostname;
109-
} else {
110-
token.host = ec.ip;
111-
}
103+
if(ec.via_host !== '') {
104+
if(ec.via_host.indexOf('https') == 0) {
105+
token.secure = true;
106+
token.host = ec.via_host.substr(8);
107+
} else {
108+
token.secure = false;
109+
token.host = ec.via_host.substr(7);
110+
}
112111

113-
if (ec.via_port !== 0) {
114-
token.host += ':' + ec.via_port;
115112
} else {
113+
token.secure = ec.ssl;
114+
if (ec.hostname !== '') {
115+
token.host = ec.hostname;
116+
} else {
117+
token.host = ec.ip;
118+
}
119+
116120
token.host += ':' + ec.port;
117-
}
121+
}
118122

119123
dataAccess.token.create(token, function(id) {
120124
getTokenString(id, token)

source/portal/index.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ config.portal = config.portal || {};
2121
config.portal.ip_address = config.portal.ip_address || '';
2222
config.portal.hostname = config.portal.hostname|| '';
2323
config.portal.port = config.portal.port || 8080;
24-
config.portal.via_address = config.portal.via_address || '';
25-
config.portal.via_port = config.portal.via_port || 0;
24+
config.portal.via_host = config.portal.via_host || '';
2625
config.portal.ssl = config.portal.ssl || false;
2726
config.portal.force_tls_v12 = config.portal.force_tls_v12 || false;
2827
config.portal.reconnection_ticket_lifetime = config.portal.reconnection_ticket_lifetime || 600;
@@ -53,13 +52,9 @@ if (config.portal.hostname.indexOf('$') == 0) {
5352
config.portal.hostname = process.env[config.portal.hostname.substr(1)];
5453
log.info('ENV: config.portal.hostname=' + config.portal.hostname);
5554
}
56-
if(process.env.owt_via_address != undefined) {
57-
config.portal.via_address = process.env.owt_via_address;
58-
log.info('ENV: config.portal.via_address=' + config.portal.via_address);
59-
}
60-
if(process.env.owt_via_port != undefined) {
61-
config.portal.via_port = process.env.owt_via_port;
62-
log.info('ENV: config.portal.via_port=' + config.portal.via_port);
55+
if(process.env.owt_via_host !== undefined) {
56+
config.portal.via_host = process.env.owt_via_host;
57+
log.info('ENV: config.portal.via_address=' + config.portal.via_host);
6358
}
6459

6560
global.config = config;
@@ -146,8 +141,7 @@ var joinCluster = function (on_ok) {
146141
info: {ip: ip_address,
147142
hostname: config.portal.hostname,
148143
port: config.portal.port,
149-
via_address: config.portal.via_address,
150-
via_port: config.portal.via_port,
144+
via_host: config.portal.via_host,
151145
ssl: config.portal.ssl,
152146
state: 2,
153147
max_load: config.cluster.max_load,

0 commit comments

Comments
 (0)