Forum Discussion

Wynand_van_Nisp's avatar
Wynand_van_Nisp
Icon for Nimbostratus rankNimbostratus
Sep 12, 2006

Change URI after evaluation and still load balance

Hi everyone,

 

 

I have a customer with a strange request. The want to specify in the URI which pool to use, then strip the part that identify it and continue with the load balance. My irules are not up to scratch yet and I have done this so far but get stuck on the removal of the "prd/" and "ppd".

 

 

Any help will be appreciated.

 

 

---- snip ----

 

when HTTP_REQUEST {

 

if {[HTTP::host] contains "soa"} {

 

if {[HTTP::uri] starts_with "/prd/"} {

 

Remove prd/ here

 

pool POOL_SOA_PRD

 

}

 

 

if {[HTTP::uri] starts_with "/ppd/"} {

 

 

Remove pPd/ here

 

pool POOL_SOA_PPD

 

}

 

else {

 

THIS IS ONLY HERE SO THAT THEY CAN KEEP TESTING

 

pool POOL_SOA_PRD

 

}

 

}

 

}

 

 

Thanks in advanced.

 

 

Wynand
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    You could do this a couple of different ways. One way you might try is with the string trim left command.

    Something like

    
    when HTTP_REQUEST {
      if {[HTTP::host] contains "soa"} {
        if {[HTTP::uri] starts_with "/prd/"} {
          HTTP::uri [string trimleft [HTTP::uri] /prd]
          pool POOL_SOA_PRD
        }
        if {[HTTP::uri] starts_with "/ppd/"} {
          HTTP::uri [string trimleft [HTTP::uri] /ppd]
          pool POOL_SOA_PPD
        } else {
           THIS IS ONLY HERE SO THAT THEY CAN KEEP TESTING
          pool POOL_SOA_PRD
        }
      }
    }

    Colin