Current logging only includes the local Docker/traefik IP, which makes the information useless.
For better monitoring and logging, the visitor's real IP has to be parsed from the Cloudflare headers provided.
CF provides a CF-Connecting-IP header containing the visitor's "real" IP, which could be used to overwrite the remoteAddress of Hapi requests.
Alternatively, the X-Forwarded-For header could be parsed, e.g. using packages like forwarded or therealyou.
Tasks
[x] Parse appropriate header to retrieve user's IP
[x] Overwrite Hapi's remoteAddress using a server plugin
Current logging only includes the local Docker/traefik IP, which makes the information useless. For better monitoring and logging, the visitor's real IP has to be parsed from the Cloudflare headers provided.
CF provides a
CF-Connecting-IP
header containing the visitor's "real" IP, which could be used to overwrite theremoteAddress
of Hapi requests. Alternatively, theX-Forwarded-For
header could be parsed, e.g. using packages like forwarded or therealyou.Tasks
remoteAddress
using a server plugin