开发者

How to check if page is being requested from a proxy?

I have a page: http://example/mypage

And there is a proxy that make a request to my page:

http://proxy/?url=http://ex开发者_运维问答ample/mypage

How can I find out if the page is opening from a blank page without proxies or if it is being requested by a proxy?


In general, you can't. When a request gets to your HTTP server, the only information you have about the client is its IP address and whatever other information the client decides to send to you in the request headers. The best you can do is look up the IP address in some kind of database to see if it's a known proxy.

If you're looking for a specific proxy that you expect to pass particular information in request headers, that's something else entirely. But in general, I can send a Web request to you from my client and make it look like a proxy, or I could send a request from a proxy and make it look like it's coming directly from the client.


I suspect there won't be a reliable way to do that, because anonymous proxies try to be ... well anonymous ... You can try to check if HttpContext.Request.UrlReferrer has some value, but that won't be reliable. You can check against some database of known proxy IP addresses, but I suspect that won't be very reliable either.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜