Apache + weblogic10g get the actual IP address of the customer

In Apache 2 In the 2 + Weblogic 10g integration system, Apache will wrap the request object and attach some header information for WLS. In this case, directly use request Getremoteaddr() cannot get the real client IP. Apache will add the following header information: x-forward-for = 211.161 1.239 WL-Proxy-Client-IP=211.161. 1.239 scheme 1: the obtained customer IP needs to be as follows: String IP = request getHeader("X-Forwarded-For"); if(ip == null || ip.length() == 0) { ip=request.getHeader("WL-Proxy-Client-IP"); } if(ip == null || ip.length() == 0) { ip=request.getRemoteAddr(); } Scheme 2: you can also directly pass the request through Weblogic settings getRemoteAddr(); Get the customer's IP. Enter the Weblogic console, find domain - > environment - > servers - > yourservername, find the advanced connection, click, find the Weblogic plug in enabled option on the subsequent page, select it and save it. This option requires a restart of weblgoic to take effect. If this option is not optional, click the "lock & Edit" button on the upper left to select it.

However, if Apache sets a reverse proxy, it will not work because Apache will not write WL proxy client IP information to the heaer. It can only be solved by the first method.

I solved this problem through scheme 2 and passed the test under windows and Linux. In addition, if Weblogic is a cluster, select Weblogic plug in enabled in each node. Scenario 1 was not verified. Original address: http://blog.sina.com.cn/s/blog_4b312fc20100e5bm.html

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>