Forum Discussion

mrp_235984's avatar
mrp_235984
Icon for Nimbostratus rankNimbostratus
Oct 12, 2017

iRule for traffic redirect to a specific port based on URI

We have a VIP that handles a lot of traffic for different apps. The servers services that URL according to the URI path entered in the browser. I was wondering if there is an iRule that can divert traffic to a port 1234 if it sees "/abc/xyz" in the URI and if not, it should use the port 5678 for all the other application traffic.

 

  • You can set up two pools, one with the pool members on port 1234 and the other with the pool members on 5678. Then you can have an iRule on your virtual server with this:

    when HTTP_REQUEST {
       if { [HTTP::uri] starts_with "/abc/xyz" } {
          pool pool_1234
       } else {
          pool pool_5678
       }
    }
    
  • You can set up two pools, one with the pool members on port 1234 and the other with the pool members on 5678. Then you can have an iRule on your virtual server with this:

    when HTTP_REQUEST {
       if { [HTTP::uri] starts_with "/abc/xyz" } {
          pool pool_1234
       } else {
          pool pool_5678
       }
    }
    
    • mrp_235984's avatar
      mrp_235984
      Icon for Nimbostratus rankNimbostratus

      Yep....tried it with an LTM policy but the iRule option worked.

       

  • dubdub's avatar
    dubdub
    Icon for Nimbostratus rankNimbostratus

    You can set up two pools, one with the pool members on port 1234 and the other with the pool members on 5678. Then you can have an iRule on your virtual server with this:

    when HTTP_REQUEST {
       if { [HTTP::uri] starts_with "/abc/xyz" } {
          pool pool_1234
       } else {
          pool pool_5678
       }
    }
    
    • mrp_235984's avatar
      mrp_235984
      Icon for Nimbostratus rankNimbostratus

      Yep....tried it with an LTM policy but the iRule option worked.