Monday, October 19, 2009

Getting client IP in application while using loadbalancer

If you are using loadbalancer with weblogic, by default all requests it sends to WebLogic will appear to come from loadbalancer IP. Your Java applications that call HttpRequest.getRemoteAddr() will return the ip address of the hardware loadblancer or software loadbalancer like proxy plugin

If you are connecting through proxy plugin ie
client -> webserver + weblogic http plugin -> weblogic instances

You need to have the WeblogicPluginEnabled attribute turned on so that a call to getRemoteAddr will return the address of the browser client from the proprietary WL-Proxy-Client-IP header instead of the web server.You can set this flag from Admin Console, either on Advanced Option of a Server or a Cluster.

If you are using hardware loadblancer ie..

client - > Hardware LB -> weblogic instances

You need to set the WL-Proxy-Client-IP header in loadbalancer level in addition to turning on WeblogicPluginEnabled attribute at weblogic layer.

No comments:

Post a Comment