Forum Discussion

Sunnypro_250536's avatar
Sunnypro_250536
Icon for Nimbostratus rankNimbostratus
May 15, 2017

iRule for Load Balancing to Different Pools depending on the URI

Hello,   We need to have a Virtual Server to be configured on our LTM's which are running on the code version 10.2.4. we need to have two LTM ports configured that needs to load balance to 6 backe...
  • Ryan_80361's avatar
    May 16, 2017

    Heya,

    You could use a policy for this but here is a quick iRule for you too (keep in mind you could also use a datagroup within the iRule).

    when HTTP_REQUEST {
    
    switch -glob [string tolower [HTTP::uri]] {
        "/def/ghi/account*" {
            pool  servers_8100
        }
        "/def/ghi/customer*" {
            pool servers_8200
        }
        "/def/ghi/equipment*" {
            pool servers_8300
        }
        "/def/ghi/order*" {
            pool servers_8400
        }
        "/def/ghi/statement*" {
            pool servers_8500
        }
        "/def/ghi/payment*" {
            pool servers_8600
        }
        "/def/ghi/financials*" {
            pool servers_8700
        }
        default {
            pool servers_default_pool
        }
    }
    }
    

    You could run the iRule/policy on both virtual servers (443/7443), just make sure any client/server ssl profiles are applied appropriately.