开发者

There is a way to know and check "who make"/"where come from" a NET/HTTP request?

There is a way to know and check "who make"/"where come from" a NET/HTTP request?

P.S.: I am using Rub开发者_如何学编程y on Rails.


You a probably looking for request.remote_ip in your controller.

You can find it in the Ruby on Rails api documentation, specifically:

Determines originating IP address. REMOTE_ADDR is the standard but will fail if the user is behind a proxy. HTTP_CLIENT_IP and/or HTTP_X_FORWARDED_FOR are set by proxies so check for these if REMOTE_ADDR is a proxy. HTTP_X_FORWARDED_FOR may be a comma- delimited list in the case of multiple chained proxies; the last address which is not trusted is the originating IP.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜