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

Commit 4521f2b

Browse files
authored
Add via ip address and port setting for nginx usage case (#608)
1 parent cb4e86d commit 4521f2b

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

source/management_api/resource/v1/tokensResource.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,20 @@ var generateToken = function (currentRoom, authData, origin, callback) {
101101
}
102102

103103
token.secure = ec.ssl;
104-
if (ec.hostname !== '') {
104+
if (ec.via_address !== '') {
105+
token.host = ec.via_address;
106+
}
107+
else if (ec.hostname !== '') {
105108
token.host = ec.hostname;
106109
} else {
107110
token.host = ec.ip;
108111
}
109112

110-
token.host += ':' + ec.port;
113+
if (ec.via_port !== 0) {
114+
token.host += ':' + ec.via_port;
115+
} else {
116+
token.host += ':' + ec.port;
117+
}
111118

112119
dataAccess.token.create(token, function(id) {
113120
getTokenString(id, token)

source/portal/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ 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;
2426
config.portal.ssl = config.portal.ssl || false;
2527
config.portal.force_tls_v12 = config.portal.force_tls_v12 || false;
2628
config.portal.reconnection_ticket_lifetime = config.portal.reconnection_ticket_lifetime || 600;
@@ -51,6 +53,14 @@ if (config.portal.hostname.indexOf('$') == 0) {
5153
config.portal.hostname = process.env[config.portal.hostname.substr(1)];
5254
log.info('ENV: config.portal.hostname=' + config.portal.hostname);
5355
}
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);
63+
}
5464

5565
global.config = config;
5666

@@ -136,6 +146,8 @@ var joinCluster = function (on_ok) {
136146
info: {ip: ip_address,
137147
hostname: config.portal.hostname,
138148
port: config.portal.port,
149+
via_address: config.portal.via_address,
150+
via_port: config.portal.via_port,
139151
ssl: config.portal.ssl,
140152
state: 2,
141153
max_load: config.cluster.max_load,

0 commit comments

Comments
 (0)