8
8
* @license For open source under AGPL-3.0
9
9
* @license For private project or commercial purposes contact us at: [email protected]
10
10
* @author Miroslav Pejic - [email protected]
11
- * @version 1.1.22
11
+ * @version 1.1.23
12
12
*/
13
13
14
14
require ( 'dotenv' ) . config ( ) ;
@@ -110,6 +110,9 @@ if (protocol === 'http') {
110
110
server = https . createServer ( options , app ) ;
111
111
}
112
112
113
+ // Trust Proxy
114
+ const trustProxy = ! ! getEnvBoolean ( process . env . TRUST_PROXY ) ;
115
+
113
116
// Cors
114
117
const cors_origin = process . env . CORS_ORIGIN ;
115
118
const cors_methods = process . env . CORS_METHODS ;
@@ -155,7 +158,7 @@ const OIDC = {
155
158
scope : 'openid profile email' ,
156
159
} ,
157
160
authRequired : process . env . OIDC_AUTH_REQUIRED ? getEnvBoolean ( process . env . OIDC_AUTH_REQUIRED ) : false ,
158
- auth0Logout : true ,
161
+ auth0Logout : process . env . OIDC_AUTH_LOGOUT ? getEnvBoolean ( process . env . OIDC_AUTH_LOGOUT ) : true , // Set to true to enable logout with Auth0
159
162
routes : {
160
163
callback : '/auth/callback' ,
161
164
login : false ,
@@ -181,6 +184,7 @@ const html = {
181
184
disconnect : path . join ( __dirname , '../' , 'public/views/disconnect.html' ) ,
182
185
} ;
183
186
187
+ app . set ( 'trust proxy' , trustProxy ) ; // Enables trust for proxy headers (e.g., X-Forwarded-For) based on the trustProxy setting
184
188
app . use ( helmet . xssFilter ( ) ) ; // Enable XSS protection
185
189
app . use ( helmet . noSniff ( ) ) ; // Enable content type sniffing prevention
186
190
app . use ( cors ( corsOptions ) ) ;
@@ -416,6 +420,7 @@ async function ngrokStart() {
416
420
const list = await api . listTunnels ( ) ;
417
421
const tunnelHttps = list . tunnels [ 0 ] . public_url ;
418
422
log . info ( 'Server is running' , {
423
+ trustProxy : trustProxy ,
419
424
oidc : OIDC . enabled ? OIDC : false ,
420
425
iceServers : iceServers ,
421
426
cors : corsOptions ,
@@ -439,6 +444,7 @@ server.listen(port, () => {
439
444
ngrokStart ( ) ;
440
445
} else {
441
446
log . info ( 'Server is running' , {
447
+ trustProxy : trustProxy ,
442
448
oidc : OIDC . enabled ? OIDC : false ,
443
449
iceServers : iceServers ,
444
450
cors : corsOptions ,
0 commit comments