Forum Discussion
Paulius
Jan 24, 2023MVP
Thiyagu I found a few curled brace errors and some - in the incorrect location but those have been corrected. I added in a variable to utilize instead of reading directly from the HTTP header when matching on the switch statement. The last bit is I used this style guide that another user created if you would like to give it a once over when you have a moment.
https://community.f5.com/t5/technical-articles/irules-style-guide/ta-p/305921
Here is the iRule that should function the way you described.
when CLIENT_ACCEPTED priority 500 {
set DEFAULT_POOL [LB::server pool]
}
when HTTP_REQUEST priority 500 {
set URI [string tolower [HTTP::uri]]
switch --glob ${URI} {
"/next/x1/*" -
"/next/x2/*" -
"/next/x3/*" {
pool POOL_NEXT_X
}
"/next/y1/*" -
"/next/y2/*" {
pool POOL_NEXT_Y
}
"/next/a1/*" {
pool POOL_NEXT_A
}
"/next/b1/*" {
pool POOL_NEXT_B
}
"/next/c1/*" {
pool POOL_NEXT_C
}
default {
pool ${DEFAULT_POOL}
}
}
}