UserHostAddress给出错误的IP地址 [英] UserHostAddress gives wrong IPs

查看:104
本文介绍了UserHostAddress给出错误的IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收集,用户访问我的网站IP地址统计,我已经注意到了什么,只有两个IP地址presented,172.16.16.1和172.16.16.248。我用它来确定IP地址的属性。

I collect statistics on IP addresses from where users visit my site and I have noticed what there are only two IP addresses presented, 172.16.16.1 and 172.16.16.248. The property I use to determine IP address is

Request.UserHostAddress

还有什么IP地址信息丢失的原因吗?所有的用户都来自世界各地,所以他们水湿只有两个代理落后。

What could be a reason of IP address information losing? All the users are from around the world, so they cann't be behind only two proxies.

推荐答案

这看起来像一个反向代理的工作。
当您使用反向代理,客户端连接到代理服务器,它本身打开到服务器的新连接。由于ASP.NET使用传入的连接的相关信息,以填补用户地址,你得到的反向代理服务器的地址。

This looks like the work of a reverse proxy. When you use a reverse proxy, the client connects to the proxy, which itself opens a new connection to your server. Since ASP.NET uses the infos of the incoming connection to fill the user address, you get the address of the reverse proxy.

如果你确实是在此配置,你需要从反向代理帮助下获得正确的信息。大多数反向代理提供到报头添加到HTTP请求时,与客户端的实际IP地址的可能性。检查您的代理的文档。

If you are indeed in this configuration, you'll need help from the reverse proxy to get the right information. Most reverse proxies offer the possibility to add a header to the HTTP request, with the real IP address of the client. Check the documentation of your proxy.

这篇关于UserHostAddress给出错误的IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆