Obtain the real ip address of the client and the ip address of the client
1. Need to introduce log4j-1.2.14.jar
Package org. ydd. test; import java. util. enumeration; import javax. servlet. http. httpServletRequest; import org. apache. log4j.
Analysis and Implementation Code for PHP to obtain the real IP address of the client, and analysis of 5 Cases
$ _ SERVER ["REMOTE_ADDR"] is often used to obtain the Client IP address in PHP.(1) If the client is accessed by a proxy server, the IP
Analysis of several PHP client IP addresses: no proxy server is used, transparent proxy server is used, normal anonymous proxy server is used, fraudulent proxy server is used, and high anonymous proxy server is used. In this article, we will
Sometimes we need to get client-side real IP, such as authentication. in general, the IP method of the client when obtaining HTTP access in Tomcat is as follows: Httpservletrequest.getremotehost () However, often we configure Apache or Nginx
PHP Solution for obtaining the real IP address of the user client, and php Solution for obtaining the ip address
Obtaining the Client ip address is not a simple task. Because of Ip Spoofing and proxy problems, obtaining the Client IP address
Occurrence of the scene: the server side to receive client requests, the general need for signature verification, client IP restrictions, and so on, in the client IP qualification, the need to first obtain the real IP. Generally divided into two
In a recently completed module, you need to get the system client's IP地址 and 物理地址(MAC地址) .1. Gets the native IP and Mac is the server, not the client's →_→Through Java, the IP address and MAC address of this machine can be completed using the
In the JSP, the method to obtain the IP address of the client is: Request.getremoteaddr (), which is valid in most cases. However, the real IP address of the client cannot be obtained through the reverse proxy software such as Apache,squid.If the
20120917 @ Zheng yu Summary
The common Java/PHP server obtains the Client IP address as follows:
PseudoCode:
1) IP = request. getheader ("X-FORWARDED-FOR")
Forge. See Appendix.
2) If the value is null or the array length is 0 or
In the Linux environment, the strong-reverse proxy of Nginx is used. As a result, the IP obtained by request. getRemoteAddr () is the IP address of the proxy server of the company, and the log records are seriously inaccurate!We all know that the
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.