Skip to content

Commit fa8e53d

Browse files
authored
Merge pull request #362 from telefonicaid/fix/from_log
fix from field log with real ip
2 parents 3fec3bc + 4fdb526 commit fa8e53d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGES_NEXT_RELEASE

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
- Upgrade NodeJS version from 16-slim to 16-bullseye-slim in Dockerfile
1+
- Fix: fill from log field with real IP
2+
- Upgrade NodeJS version from 16-slim to 16-bullseye-slim in Dockerfile

lib/utils/logging.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ function requestLogger(componentName) {
4444
contextSubsrv = req.headers[constants.SUBSERVICE_HEADER];
4545
}
4646
let contextFrom;
47+
contextFrom = req.ip || req.connection.remoteAddress;
4748
// x-forwarded-for/forwarded overwrites x-real-ip
4849
if (req.headers[constants.X_REAL_IP_HEADER]) {
4950
contextFrom = req.headers[constants.X_REAL_IP_HEADER];

0 commit comments

Comments
 (0)