@ -28,7 +28,12 @@ lasso.configure(require("./marko-config"))
// Set trusted proxy
// Set trusted proxy
if ( config . trustedProxy != null ) {
if ( config . trustedProxy != null ) {
if ( ip . isV4Format ( config . trustedProxy ) || ip . isV6Format ( config . trustedProxy ) ) {
if ( config . trustedProxy === "GATEWAY" ) {
const ip = require ( "child_process" ) . execSync ( "/sbin/ip route|awk '/default/ { print $3 }'" ) . toString ( ) . trim ( )
app . set ( 'trust proxy' , ip )
console . log ( "Trusting proxy from default gateway" , ip ) ;
} else if ( ip . isV4Format ( config . trustedProxy ) || ip . isV6Format ( config . trustedProxy ) ) {
app . set ( 'trust proxy' , config . trustedProxy )
app . set ( 'trust proxy' , config . trustedProxy )
console . log ( "Trusting proxy" , config . trustedProxy ) ;
console . log ( "Trusting proxy" , config . trustedProxy ) ;
@ -128,4 +133,4 @@ app.listen(config.port, function() {
// Handle shutdown signals (Docker needs this to shutdown quickly)
// Handle shutdown signals (Docker needs this to shutdown quickly)
process . on ( 'SIGINT' , ( ) => process . exit ( 0 ) )
process . on ( 'SIGINT' , ( ) => process . exit ( 0 ) )
process . on ( 'SIGTERM' , ( ) => process . exit ( 0 ) )
process . on ( 'SIGTERM' , ( ) => process . exit ( 0 ) )