asp.netproxyhttp-request

How to tell if a Request is coming from a Proxy?


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?


Solution

  • 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: 
    

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