In a meteor method runs on server, I’m trying to get client ip address but it doesn’t work.
Meteor.methods({
'testClientIpAddress': () => {
console.log(this.connection); // I got undefined all the time.
if (this.connection) {
return this.connection.clientAddress;
}
return null;
},
here is my nginx config
server {
listen 443;
listen [::]:443;
# some ssl, domain goes here
location / {
# my meteor runs on port 3500
proxy_pass http://localhost:3500;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forward-Proto http;
proxy_set_header X-Nginx-Proxy true;
proxy_redirect off;
}
}