print CF-Connecting-IP/X-Forwarded-For when present
This commit is contained in:
parent
cf8f3f0dcd
commit
1382a6a21e
@ -27,7 +27,12 @@ function setupRoutes() {
|
||||
function handleRequest(req, res) {
|
||||
var requestUrl = url.parse(req.url).pathname;
|
||||
|
||||
logger.log('info', '%s requested: %s', req.connection.remoteAddress, requestUrl);
|
||||
let remoteAddress = req.connection.remoteAddress;
|
||||
if (req.headers && (req.headers['cf-connecting-ip'] || req.headers['x-forwarded-for'])) {
|
||||
remoteAddress = req.headers['cf-connecting-ip'] || req.headers['x-forwarded-for'];
|
||||
}
|
||||
|
||||
logger.log('info', '%s requested: %s', remoteAddress, requestUrl);
|
||||
|
||||
if (requestUrl === '/publicConfig.json') {
|
||||
res.setHeader('Content-Type', 'application/javascript');
|
||||
|
Loading…
x
Reference in New Issue
Block a user