Persistence on NetScaler based on X-Forwarded-For
Feb 20, 2019 · CommentsCitrix ADC
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
- You need an X-Forwarded-For header inserted by NetScaler to do this.
- This has been tested on Citrix NetScaler VPX 11.1 56.19.
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”.
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.