Skip to content

Commit

Permalink
log client IP
Browse files Browse the repository at this point in the history
  • Loading branch information
vladupshot committed Jul 2, 2024
1 parent 0a20bee commit 2ed0f99
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion faucet.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ app.set("view engine", "ejs");
const checker = new FrequencyChecker(conf)

app.use((req, res, next) => {
console.log(`Received ${req.method} request at ${req.url}`);
const clientip = req.headers['x-real-ip'] || req.headers['X-Real-IP'] || req.headers['X-Forwarded-For'] || req.ip
console.log(`Received ${req.method} request at ${req.url} from ${clientip}`);
next();
});

Expand Down

0 comments on commit 2ed0f99

Please sign in to comment.