Forum Discussion

3 Replies

  • Hi Mostafa,


    Have you already found any iRule that does anything similar to what you need? Have a look in the Codeshare (see links at the top) to find something similar and then tweak it to what you need. Here is an example that should be pretty close to what you need;


    Alternatively, for this function, Local Traffic Policies are very suitable. In your F5, go to Local Traffic - Policies and create a new policy. You can then use drop-down menus to make Match-Action statements. I'm using these to do load balancing on the Host header myself. (More details:


    Hope this helps.





    • Thanks for your reply, i can't use LTM policy as the header is not well-known, it is developed by application developer team.

      So if i use the below IRule, is that enough to make what i need or not.


      when HTTP_REQUEST {

       if { [HTTP::header "name"] contains "value" } {

        node 80



      • AlexBCT's avatar
        Icon for Cumulonimbus rankCumulonimbus

        Hi Mostafa,


        In your iRule, as you are load balancing to a member (IP address plus a port number), rather than a node (IP address only), you should use a different syntax;


        pool my_Pool member 80


        See more details here:

        But yes, for the rest it looks pretty good to me!


        Coming back to the LTM policy though, this can also work with non-standard headers, see an example of it below. If you can do it that way, it will be less error-prone but also more efficient to run.