简体   繁体   English

流星在Nginx Passenger后面获取客户端IP地址

[英]Meteor get client IP address behind Nginx Passenger

I'm running Meteor behind Nginx with Passenger. 我正在与“乘客”一起在Nginx后面运行流星。

this.connection.clientAddress returns the IP in my dev environment but behind nginx and passenger, it's undefined. this.connection.clientAddress返回我的开发环境中的IP,但在nginx和passenger之后,它是未定义的。

X-Forwarded-For $remote_addr; X-Forwarded-For $ remote_addr; added to the nginx config does not change anything. 添加到nginx配置中不会更改任何内容。

Here what I added to my nginx conf: 这是我添加到我的nginx conf中的内容:

passenger_set_cgi_param HTTP_FORWARDED_COUNT 1;
passenger_set_cgi_param HTTP_X_FORWARDED_FOR $remote_addr;

Any idea? 任何想法?

On proxy machine set: 在代理计算机集上:

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

On proxied machine add ( Replace 10.0.1.1 with your proxy machine local network IP ): 在代理计算机上添加( 代理计算机的本地网络IP替换10.0.1.1 ):

set_real_ip_from  10.0.1.1;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM