Persistence on NetScaler based on X-Forwarded-For

Sometimes you can’t use cookie persistence, or Source IP persistence, based on the fact that you do several layers of load balancing. But you might still want to load balance that last layer. Then it is possible to use a custom rule on NetScaler to loadbalance based on X-Forwarded-For header.

Pre-requirements

Implementing

If you go to “Edit” on the “Load Balancing” -> “Virtual Server” that you want to change. Then you add the “Persistence” choice, and choose “Edit”.

post21-netscaler_custom_persistence_01

The text in the rule is:

HTTP.REQ.HEADER("X-Forwarded-For").BEFORE_STR(",")

Now press “Done”, and you’re all done!

If you want to verify you can press “Traffic Management” in the menu, and then choose “Virtual Server persistence sessions”. It should then show you a list of the current split.


comments powered by Disqus