I have created a web application and an API application using meteorjs, and i implemented an API call from my web application server side function using fetch package to my API application, for security check i have implemented a middle-ware function to check the ip address of request. (My apps are deployed in galaxy and i have enabled IP whitelisting) ,
when i checking the ip from request its not showing the static ip address, it just showing the galaxy local ip, how can i get the static ip of galaxy from the request object which is sent from meteor app server side method using fetch package.? Thanks in advance.
here is my code,
/**
-
Check IP [Middleware]
*/
JsonRoutes.Middleware.use(function (request, response, next) {
next();const ALLOWED_IPs = Meteor.settings.public.allowed_ips;
const ipAddress = request.connection.remoteAddress;
console.log("Remote IP: "+ipAddress);
if(ALLOWED_IPs.includes(ipAddress)){
next();
}else{
console.log(“IP not allowed.”);
return false;
}
});