diff --git a/nodejs-mini-message-board/src/app.js b/nodejs-mini-message-board/src/app.js index d59c884..6bd601e 100644 --- a/nodejs-mini-message-board/src/app.js +++ b/nodejs-mini-message-board/src/app.js @@ -17,7 +17,9 @@ app.use(express.urlencoded({ extended: true })); //Logging app.use((req, res, next) => { req.time = new Date(Date.now()).toISOString(); - console.log(req.time, req.method, req.hostname, req.path); + const clientIp = + req.header("http_cf_connecting_ip") || req.socket.remoteAddress; + console.log(req.time, req.method, req.hostname, req.path, clientIp); next(); });