Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

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

0
Rate this Question
Comments on this Question
Comment made 12-Oct-2017 by dubdub 358

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

0
Comment made 12-Oct-2017 by RossVermette 292

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 }
    }
}
0
Comment made 14-Oct-2017 by sanalbabu 118

Hello RossVermette,

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

Thanks

0
Comment made 14-Oct-2017 by sanalbabu 118

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

0

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

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 }
    }
}
0
Comments on this Answer
Comment made 15-Oct-2017 by sanalbabu 118

Hello Faruk,

I have applied the rule without blank part only. Here the issue is projects.com and sss.xyz.projects.com is working fine. The second URL xyz.projects.com is not get through.Not sure what is the issue is.

Thank you

0
Comment made 15-Oct-2017 by Faruk AYDIN 699

omit "-glob" option.

0
Comment made 21-Oct-2017 by Faruk AYDIN 699

Hope it helps

Please mark it as answer if it works

Regards

0
Comment made 22-Oct-2017 by sanalbabu 118

Hello Guys,

Issue has been fixed. Irule works perfectly but the back end server had an SSL issue which was stopping the page.Issue resolved. Thanks guys for the support.

Irule used :

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

0