Normally
when requests pass through load balancers client IP for actual back
end server would be load balancers IP. But sometimes actual back
end server may need actual client and load balancers (all load
balancers message passed) IPs to tracing message flows. In such cases
normally we use X-Forwarded-For[1] header.
If we need to achieve same using WSO2 elastic load balancer we need to
add following configuration to main sequence. Also if header is already
present we should append ip by separating ",". We can use this to avoid
masking client IP from WSO2 ELB
[1]http://en.wikipedia.org/ wiki/X-Forwarded-For
Add following configuration to main sequence in flow
[1]http://en.wikipedia.org/
Add following configuration to main sequence in flow
<filter source="get-property('transport','X-Forwarded-For')" regex=".*"> <then> <property name="coming-X-Forwarded-For" expression="fn:concat(get-property('transport','X-Forwarded-For'), ', ')" scope="axis2" type="STRING"/> <property name="clientIP" expression="get-property('axis2','REMOTE_ADDR')"/> <property name="X-Forwarded-For" expression="fn:concat(get-property('axis2','coming-X-Forwarded-For'), get-property('clientIP'))" scope="transport" type="STRING"/> </then> <else> <property name="X-Forwarded-For" expression="get-property('axis2','REMOTE_ADDR')" scope="transport" type="STRING"/> </else> </filter>
No comments:
Post a Comment