如何判断请求是否来自代理? [英] How to tell if a Request is coming from a Proxy?

查看:21
本文介绍了如何判断请求是否来自代理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以检测传入请求是否是通过代理服务器发出的?如果 Web 应用程序通过 IP 地址禁止"用户,他们可以使用代理服务器绕过这一点.这只是阻止这些请求的原因之一.如何实现?

Is it possible to detect if an incoming request is being made through a proxy server? If a web application "bans" users via IP address, they could bypass this by using a proxy server. That is just one reason to block these requests. How can this be achieved?

推荐答案

恕我直言,没有 100% 可靠的方法来实现这一点,但是以下任何标头的存在都强烈表明该请求是从代理服务器路由的:

IMHO there's no 100% reliable way to achieve this but the presence of any of the following headers is a strong indication that the request was routed from a proxy server:

via:
forwarded:
x-forwarded-for:
client-ip: 

您还可以在客户端域名中查找 proxypxy.

You could also look for the proxy or pxy in the client domain name.

这篇关于如何判断请求是否来自代理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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