Closed gtchecker closed 3 years ago
There are many different custom headers many providers provide. The good thing is that we already support them -- through the use of custom tokens (like you did) or through our existing req
token: :req[cf-connecting-ip]
There are many different custom headers many providers provide. The good thing is that we already support them -- through the use of custom tokens (like you did) or through our existing
req
token::req[cf-connecting-ip]
I tried to do the way you stated but it never worked so I went ahead and made stated above.
Strange. That would be a bug. Can you provide a reproduction case we can debug and determine the issue? Based on your code above, :req[cf-connecting-ip]
should work, and if not, that is absolutely a bug.
I will reproduce the case later on tomorrow as I am currently away from my Desk right now. Sorry for the inconvenience.
working fine:
morgan.token('remote-addr', function (req, res) { return req.headers['cf-connecting-ip'] });
I have modified the morgan module to suit my needs but this should be implemented for those using Cloudflare.
Line 296-300
added this to line 505-507
Example of Usage