[SOLVED] Meteor app in Docker container is picking up wrong IP address

I just now noticed that my app is only seeing one IP from visitors: 172.17.0.1. Apparently this is because it’s running inside a Docker container, which nginx is proxying traffic into. I already have these variables set in the nginx conf:

proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;

But this makes no difference. Is there something else I need to do to correct this?

A what is the problem, cant you access that X-Forwarded-For field in header ?

Apparently not? I first noticed this from the mizzao:user-status package, which pulls in IP address (I believe) from Meteor’s connection object.

Aha!

http://docs.meteor.com/#/full/meteor_onconnection

Setting HTTP_FORWARDED_COUNT to 1 in the environment fixed this!

Did you set the environmental variable via shell on your cloud server or did you simply do it in your Meteor.isServer statement?