Forum Discussion

Sanal_Babu's avatar
Sanal_Babu
Icon for Altostratus rankAltostratus
Oct 12, 2017

iRule for pool redirection based on uri

Pool AAA member x.x.x.x port 80

 

Pool BBB member y.y.y.y port 8443

 

Pool CCC

 

member x.x.x.x port 8080

 

Request for projects.com has to be redirected to Pool AAA

 

Request for xyz. projects.com has to be re directed to pool BBB.

 

Request for sss.xyz.projects.com should go to pool CCC.

 

I have configured some irule with “contains” switch glob” but somehow redirection for sss.xyz.projects.com is not working.Other 2 are fine.

 

Please to be keep in mind that the pool members of pool AAA&CCC are same and only port differs...Appreciate any help....

 

Thanks

 

  • dubdub's avatar
    dubdub
    Icon for Nimbostratus rankNimbostratus

    Does your switch statement list the "sss.xyz.projects.com" clause first? Can you post the switch portion of the rule?

     

  • Try this:

    when HTTP_REQUEST {
        switch -glob [string tolower [HTTP::host]] {
            "projects.com" { pool AAA }
            "xyz. projects.com" {pool BBB}
            "sss.xyz.projects.com" { pool CCC }
        }
    }
    
  • Hello RossVermette,

     

    This is what exactly i have tried but the traffic is not passing to the pool CCC.

     

    Thanks

     

  • Update :

     

    When i apply the irule, projects.com and sss.xyz.projects.com works fine. But the second URL which is xyz.projects.com is not working.Any thoughts ?

     

    Thanks

     

  • Hi Guy,

    Ross's answer is correct, but there is a mistake. You must delete the blank in "xyz. projects.com". Corrected version is:
    when HTTP_REQUEST {
        switch -glob [string tolower [HTTP::host]] {
            "projects.com" { pool AAA }
            "xyz.projects.com" {pool BBB}
            "sss.xyz.projects.com" { pool CCC }
        }
    }