mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Handling undefined hostname
This commit is contained in:
parent
e3fecd61d0
commit
3aa36520d4
1 changed files with 6 additions and 1 deletions
|
@ -11,7 +11,12 @@ module.exports = function (options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const ip = req.headers['cf-connecting-ip'] || req.connection.remoteAddress
|
const ip = req.headers['cf-connecting-ip'] || req.connection.remoteAddress
|
||||||
const hostname = req.hostname.replace('www.', '').split('.')[0]
|
let hostname = 'UNDEF'
|
||||||
|
if (req.hostname) {
|
||||||
|
hostname = req.hostname.replace('www.', '').split('.')[0]
|
||||||
|
} else {
|
||||||
|
logger.Log('Hostname is undefined!', logger.GetColor('redbg'))
|
||||||
|
}
|
||||||
|
|
||||||
// fixme: regexp includes checking
|
// fixme: regexp includes checking
|
||||||
const hasLoggableKeyword = loggableKeywords && loggableKeywords.some((x) => {
|
const hasLoggableKeyword = loggableKeywords && loggableKeywords.some((x) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue