-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mirotalkbro] - add trust proxy, fix typo, update env
- Loading branch information
1 parent
4e8c73c
commit 7704f52
Showing
3 changed files
with
16 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
* @license For open source under AGPL-3.0 | ||
* @license For private project or commercial purposes contact us at: [email protected] | ||
* @author Miroslav Pejic - [email protected] | ||
* @version 1.1.22 | ||
* @version 1.1.23 | ||
*/ | ||
|
||
require('dotenv').config(); | ||
|
@@ -110,6 +110,9 @@ if (protocol === 'http') { | |
server = https.createServer(options, app); | ||
} | ||
|
||
// Trust Proxy | ||
const trustProxy = !!getEnvBoolean(process.env.TRUST_PROXY); | ||
|
||
// Cors | ||
const cors_origin = process.env.CORS_ORIGIN; | ||
const cors_methods = process.env.CORS_METHODS; | ||
|
@@ -155,7 +158,7 @@ const OIDC = { | |
scope: 'openid profile email', | ||
}, | ||
authRequired: process.env.OIDC_AUTH_REQUIRED ? getEnvBoolean(process.env.OIDC_AUTH_REQUIRED) : false, | ||
auth0Logout: true, | ||
auth0Logout: process.env.OIDC_AUTH_LOGOUT ? getEnvBoolean(process.env.OIDC_AUTH_LOGOUT) : true, // Set to true to enable logout with Auth0 | ||
routes: { | ||
callback: '/auth/callback', | ||
login: false, | ||
|
@@ -181,6 +184,7 @@ const html = { | |
disconnect: path.join(__dirname, '../', 'public/views/disconnect.html'), | ||
}; | ||
|
||
app.set('trust proxy', trustProxy); // Enables trust for proxy headers (e.g., X-Forwarded-For) based on the trustProxy setting | ||
app.use(helmet.xssFilter()); // Enable XSS protection | ||
app.use(helmet.noSniff()); // Enable content type sniffing prevention | ||
app.use(cors(corsOptions)); | ||
|
@@ -416,6 +420,7 @@ async function ngrokStart() { | |
const list = await api.listTunnels(); | ||
const tunnelHttps = list.tunnels[0].public_url; | ||
log.info('Server is running', { | ||
trustProxy: trustProxy, | ||
oidc: OIDC.enabled ? OIDC : false, | ||
iceServers: iceServers, | ||
cors: corsOptions, | ||
|
@@ -439,6 +444,7 @@ server.listen(port, () => { | |
ngrokStart(); | ||
} else { | ||
log.info('Server is running', { | ||
trustProxy: trustProxy, | ||
oidc: OIDC.enabled ? OIDC : false, | ||
iceServers: iceServers, | ||
cors: corsOptions, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters