Browse Source

Merge branch '1.2'

master
Gisle Aune 6 years ago
parent
commit
494d0404ed
  1. 41
      server.js

41
server.js

@ -33,20 +33,33 @@ if (config.trustedProxy != null) {
console.log("Trusting proxy", config.trustedProxy); console.log("Trusting proxy", config.trustedProxy);
} else { } else {
dns.resolve4(config.trustedProxy, (err, res) => {
if (err != null) {
console.error("Failed to resolve trustedProxy hostname")
console.error(err)
process.exit(1)
}
if (res.length === 0) {
console.error("No results for trustedProxy hostname")
process.exit(1)
}
console.log("Trusting proxy", res[0], `(${config.trustedProxy})`);
app.set('trust proxy', res[0])
})
let trusted = null
setInterval(() => {
dns.resolve4(config.trustedProxy, (err, res) => {
if (err != null) {
if (trusted === null) {
console.error("Failed to resolve trustedProxy hostname")
}
return
}
if (res.length === 0) {
if (trusted === null) {
console.error("No results for trustedProxy hostname")
}
return
}
if (trusted !== res[0]) {
console.log("Trusting proxy", res[0], `(${config.trustedProxy})`);
app.set('trust proxy', res[0])
trusted = res[0]
}
})
}, 1000)
} }
} }

Loading…
Cancel
Save