Obtain the client's real IP Address

Source: Internet
Author: User


We often record audit logs. How can we obtain the real IP address of the client? Let's take a look at the HTTP header. Before discussing how to obtain the Client IP address, we first understand the following three meanings: REMOTE_ADDR, HTTP_CLIENT_IP, HTTP_X_FORWARDED_FOR REMOTE_ADDR is the IP address when your client "shakes hands" with your server. If "anonymous proxy" is used, REMOTE_ADDR displays the IP address of the proxy server. HTTP_CLIENT_IP is the HTTP header sent by the proxy server. If it is a "Super anonymous proxy", the return value is none. Similarly, REMOTE_ADDR will be replaced with the IP address of the proxy server. X-Forwarded-) or this option is added only when the server Load balancer is running. It is not the standard request header information defined in RFC. You can find this item in the squid cache proxy server development documentation. The standard format is as follows: X-Forwarded-For: client1, proxy1, proxy2 $ _ SERVER ['remote _ ADDR ']; // The access end (possibly a user, it may be a proxy) IP $ _ SERVER ['HTTP _ CLIENT_IP ']; // proxy end (it may exist and can be forged) $ _ SERVER ['HTTP _ X_FORWARDED_FOR ']; // proxy of the user's IP address (which may exist or can be forged) I. No proxy SERVER is used: www.2cto.com REMOTE_ADDR = Your IP HTTP_CLIENT_IP = no value or no display of HTTP_X_FORWARDED_FOR = no value or no display of 2. Use of transparent Proxy Server: transparent Proxies REMOTE_ADDR = IP address of the last Proxy Server HTTP_CLIENT_IP = IP address of the proxy server H TTP_X_FORWARDED_FOR = your real IP address. When multiple proxy servers are used, the value is similar to the following: 203.98.1820.3, 203.98.1820.3, 203.129.72.215. This type of proxy server still forwards your information to your access object, which cannot hide your real identity. Iii. Normal Anonymous proxy server: Anonymous Proxies REMOTE_ADDR = last Proxy Server IP HTTP_CLIENT_IP = Proxy Server IP HTTP_X_FORWARDED_FOR = Proxy Server IP, when multiple proxy servers pass through, this value is similar to the following: 203.98.182.163, 203.98.182.163, 203.129.72.215. Your real IP address is hidden, but you are disclosed to the access object that you use the proxy server to access them. Iv. Use of fraudulent proxy servers: Distorting Proxies REMOTE_ADDR = Proxy Server IP HTTP_CLIENT_IP = Proxy Server IP HTTP_X_FORWARDED_FOR = random IP address. When multiple proxy servers pass through, this value is similar to the following: 203.98.182.163, 203.98.182.163, 203.129.72.215. Www.2cto.com tells the access object that you have used the proxy server, but fabricated a false random IP address instead of your real IP address to cheat it. 5. Use highly anonymous proxy servers: High Anonymity Proxies (Elite proxies) REMOTE_ADDR = Proxy Server IP HTTP_CLIENT_IP = no value or HTTP_X_FORWARDED_FOR = not displayed, when multiple proxy servers are used, the value is as follows: 203.98.182.163, 203.98.182.163, 203.129.72.215. The proxy server information replaces all your information, just as you directly access the object using the proxy server. Author and artist

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.