We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
需求:限制设备访问API接口时的速率,例如每30秒一次
我使用的安卓手机与PC的chorme浏览器,这两个设备共同连接的时同一个Wifi 先后进行访问API 如:http://101.101.101.100:1314/API/Test
实际上我得到的结果是,当PC访问后,安卓再进行访问,则是不行的。
服务器得到的输出,访问源的IP是同一个 我使用了以下代码来得到访问IP Console.WriteLine(HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString());
我想知道的是,是什么原因?也许是设置的问题吧
The text was updated successfully, but these errors were encountered:
Since you asked the question in Chinese, I will answer it in Chinese。
一般情况下,这种是不会的,目前我所知的,下列情况中的【任何一个】都会导致你的问题:
获取到的IP会是一下几种:
上述情况可能会混合,如果有混合情况,会导致分析更加复杂。
针对情况1,可以在反向代理服务器上设置x-forwarded请求头(程序中依然需要配置解析)解决。 参考:https://learn.microsoft.com/zh-cn/aspnet/core/host-and-deploy/proxy-load-balancer?view=aspnetcore-7.0
其余情况请针对情况修改网络架构
Sorry, something went wrong.
No branches or pull requests
需求:限制设备访问API接口时的速率,例如每30秒一次
我使用的安卓手机与PC的chorme浏览器,这两个设备共同连接的时同一个Wifi
先后进行访问API 如:http://101.101.101.100:1314/API/Test
实际上我得到的结果是,当PC访问后,安卓再进行访问,则是不行的。
服务器得到的输出,访问源的IP是同一个
我使用了以下代码来得到访问IP
Console.WriteLine(HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString());
我想知道的是,是什么原因?也许是设置的问题吧
The text was updated successfully, but these errors were encountered: