Label: style blog HTTP color AR for SP Div log Public static string getipaddr (httpservletrequest request ){
String IP = request. getheader ("X-real-IP ");
If (! Stringutils. isblank (IP )! "Unknown". inclusignorecase (IP )){
Return IP;
}
Through Nginx reverse proxy, will not get the real IP, is to obtain the Nginx IP, to get the real IP to be configured nginx configuration file: nginx.conf
Proxy_set_header X-real-ip $remote _addr;
For example:
###############################################################
_add_x_forwarded_for;}look at the red font, these configurations are related to the following to get the IP. ———————————————————————————————--First Pass | X-forwarded-for: background--This is a Squid development field, not an RFC standard. Referred XFF Header , this item is added only if the HTTP proxy or Load balancer server is passed. A detailed description of
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 a
Obtain the real IP address of the client under multi-level reverse proxy [Squid]
In many applications, you may need to record the real IP address of the user. In this case, you need to obtain the real IP
In JSP, the method for obtaining the Client IP address is request. getRemoteAddr (), which is valid in most cases. However, the real IP address of the client cannot be obtained through reverse proxy software such as Apache and Squid.
If reverse
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 reverse
Note: There are two limitations to the code:
1. The client must be a Windows operating system
2. The program code deployed to Linux when the desired effect, access to the IP is 127.0.0.1 so IP access to the MAC address is also inaccurate, to be improved ....
3. Please the enthusiastic friend message comments, thanks for pointing the maze!
Import java.io.IOExcepti
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 reverse
In nginx reverse proxy, thinkphp and php cannot obtain the correct Internet ip address. nginxthinkphp
When a user needs to obtain the user's ip address to send a text message, tp always obtains the Intranet ip
In many applications, you may need to record the real IP address of the user. In this case, you need to obtain the real IP address of the user. In JSP, you can obtain the IP address of the client by: request. getRemoteAddr (), whi
After nginx reverse proxy, all the IP addresses obtained in the application are the IP addresses of the reverse proxy server, and the obtained domain name is also the Domain Name of the URL configured by the reverse proxy, you nee
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 reverse
From the Blogjava an article, wrote a good, original address:
Http://www.blogjava.net/Alpha/archive/2006/07/12/57764.html?Pending=true#Post
In many applications may have to the user's real IP records down, at this point to get the user's real IP address, in the JSP, obtain the client's
different network.to achieve communication between the two networks, you must pass through the gateway. If the host in Network a discovers that the destination host for the packet is not on the local network, forwards the packet to its own gateway, which is then forwarded by the gateway to Network B's gateway, and the gateway of Network B is forwarded to a host on network B.(as shown in the attached drawings). The process by which network a forwards packets to network B. So, only set up the
Nginx reverses the proxy to the backend and sends the IP address to the back-end tomcat.Suppose our website is called demo.demo.comThe front-end nginx configuration is as follows:/usr/local/nginx/conf/nginx.conf Add the following 4 lines to the HTTP segment:proxy_set_header X-Forwarded-For $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;p
The implementation of the CULR proxy IP address! [Urgent] print $ _ SERVER ['remote _ ADDR ']; get the real IP address $ _ SERVER ['http _ X_FORWARDED_FOR']; get the
How to obtain the real IP address of nginx for reverse proxy?Real IP address used by nginxto reverse proxy1. Compile
For client-> nginxreverseproxy-> apache,
To get the real IP address
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.