Determine whether a client uses a proxy server and its anonymous level

Source: Internet
Author: User
Tags php example

Transferred from: http://www.cnblogs.com/heiing/archive/2010/04/19/1715304.html

To determine whether a client uses a proxy server, it can be judged from the environment variable information sent by the client.

Specifically, just look at the Http_via field, if this field is set, the client uses a proxy server.

The anonymous level can be judged by the following table.

Give an example of application, you can hang up the agent trial effect: http://ip.mixsec.org/

one, not using the proxy server situation :
REMOTE_ADDR = Your IP
Http_via = no value or no display
Http_x_forwarded_for = no value or no display


second, the use of transparent proxy server situation: Transparent Proxies

REMOTE_ADDR = Proxy Server IP
Http_via = proxy IP ( supplemental: This field is populated by a proxy server, sometimes populating gateway information, etc. )
Http_x_forwarded_for = Your real IP
This type of proxy server also forwards your information to your Access object, and does not achieve the purpose of hiding the true identity.

third, the use of ordinary anonymous proxy server situation: Anonymous Proxies
REMOTE_ADDR = Proxy Server IP
Http_via = proxy IP ( supplemental: This field is populated by a proxy server, sometimes populating gateway information, etc. )
http_x_forwarded_for = Proxy Server IP
Hides your real IP, but reveals to the Access object that you are using a proxy server to access them.

Iv. use of deceptive proxy servers: Distorting Proxies
REMOTE_ADDR = Proxy Server IP
Http_via = proxy IP ( supplemental: This field is populated by a proxy server, sometimes populating gateway information, etc. )
Http_x_forwarded_for = Random IP
Tells the Access object that you used a proxy server, but fabricated a bogus random IP to spoof it instead of your real IP.

v. Use of high anonymous proxy servers: High Anonymity Proxies
REMOTE_ADDR = Proxy Server IP
Http_via = no value or no display
Http_x_forwarded_for = no value or no display
Full use of Proxy server information replaces all of your information, as if you were using the proxy server directly to access the object.


In addition, the proxy judges can be used to summarize other reference information, once again in practice.

Finally write a php example, for your reference only:

if (!empty ($_server[' Http_via '))//using a proxy
{
if (!isset ($_server[' http_x_forwarded_for '))
{
Anonymous Proxies normal Anonymous proxy server

Proxy IP address is $_server[' REMOTE_ADDR ']

}
Else
{
Transparent Proxies Transparent proxy Server
Proxy IP address is $_server[' REMOTE_ADDR ']
The real IP address is $_server[' http_x_forwarded_for ']
}
}
else//no agent or High anonymous proxy
{
The real IP address is $_server[' REMOTE_ADDR ']
}

Determine whether a client uses a proxy server and its anonymous level

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.