ActionDispatch::RemoteIp::IpSpoofAttackError

使用 unicorn + nginx 运行 rails 有一段时间了,之前 nginx 这样配置 ip 地址

proxy_set_header X-Real-IP $remote_addr;

发现 rails 中获取到的 ip 是 127.0.0.1 , 然后又配置 CLIENT_IP

proxy_set_header CLIENT_IP $remote_addr;

这样配置之后就发现了 rails 的错误

ActionDispatch::RemoteIp::IpSpoofAttackError

原来 rails 有 ip 防欺骗,再改 ningx 配置,加入

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

之后就 ok 了,想来想去这个防 ip 欺骗,是防不住的啊

This entry was posted in ruby on rails and tagged , , , . Bookmark the permalink.

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>