To determine whether the client uses a proxy server, you can judge it from the environment variable information sent by the client.
Specifically, look at the HTTP_VIA field. If this field is set, it means that the client uses a proxy server.
The anonymity level can be judged by referring to the table below.
Give an application example, you can hang the agent to try the effect: /
1. No proxy server is used:
REMOTE_ADDR = Your IP
HTTP_VIA = No value or no display
HTTP_X_FORWARDED_FOR = No value or no display
2. The situation of using transparent proxy server: Transparent Proxies
REMOTE_ADDR = proxy server IP
HTTP_VIA = proxy server IP (Supplement: This field is populated by proxy server, sometimes populated with gateway information, etc.)
HTTP_X_FORWARDED_FOR = Your real IP
This type of proxy server still forwards your information to your access object, and cannot achieve the purpose of hiding your true identity.
3. The situation of using ordinary anonymous proxy server: Anonymous Proxies
REMOTE_ADDR = proxy server IP
HTTP_VIA = proxy server IP (Supplement: This field is populated by proxy server, sometimes populated with gateway information, etc.)
HTTP_X_FORWARDED_FOR = proxy server IP
Hidden your real IP, but reveals to the access object that you are accessing them using a proxy server.
4. The situation of using a deceptive proxy server: Distorting Proxies
REMOTE_ADDR = proxy server IP
HTTP_VIA = proxy server IP (Supplement: This field is populated by proxy server, sometimes populated with gateway information, etc.)
HTTP_X_FORWARDED_FOR = Random IP
Telling the access object that you used a proxy server, but fabricated a fake random IP instead of your real IP to spoof it.
5. The situation of using a high anonymous proxy server: High Anonymity Proxies
REMOTE_ADDR = proxy server IP
HTTP_VIA = No value or no display
HTTP_X_FORWARDED_FOR = No value or no display
All your information is completely replaced by the proxy server information, just like you are using that proxy server to directly access the object.
In addition, some other judgment information for reference can be summarized through proxy judges and used in practice.
Finally, I will write a php example for your reference only:
if(!empty($_SERVER['HTTP_VIA'])) //Proxy is used
{
if(!isset($_SERVER['HTTP_X_FORWARDED_FOR']))
{
//Anonymous Proxies Ordinary anonymous proxy server
//The proxy IP address is $_SERVER['REMOTE_ADDR']
}
else
{
//Transparent Proxies Transparent Proxies Server
//The proxy IP address is $_SERVER['REMOTE_ADDR']
//The real ip address is $_SERVER['HTTP_X_FORWARDED_FOR']
}
}
else //No proxy or highly anonymous proxy
{
//The real ip address is $_SERVER['REMOTE_ADDR']
}