Description
When accessing the ip of the request in a microservice, we expect the ip of the user, not the API Gateway
Steps to Reproduce
- Activate a microservice and the api-gateway
- Send a request via the api gateway to the microservice
- Note the ip address logged in the microservice is the ip of the api-gateway
Expected Behavior
The IP of the user is forwarded
Actual Behavior
The IP of the user is not forwarded
Proposed fix
Change instances of req.ip to req.headers && req.headers['x-forwarded-for'] || req.ip
Description
When accessing the ip of the request in a microservice, we expect the ip of the user, not the API Gateway
Steps to Reproduce
Expected Behavior
The IP of the user is forwarded
Actual Behavior
The IP of the user is not forwarded
Proposed fix
Change instances of
req.iptoreq.headers && req.headers['x-forwarded-for'] || req.ip