BootsHasDrugs
Apr 21, 2023Altostratus
iRule switch pool based on URI
Hello
A request was made to re-write/redirect traffic to a different pool based on URI. That is fairly simple with HTTP_REQUEST, and switch. However, this site is using SSO, so if I try something similar it just dumps you back out after authentication.
For example:
when HTTP_REQUEST {
###
# Static variables
###
set default_pool "sample-site.com-HTTPS"
set non_default_pool "sample-site.com-NON-DEFAULT"
set hostlist [list sample-site.com]
if { [lsearch $hostlist [string tolower [HTTP::host]]] ne -1 } {
switch -glob [string tolower [HTTP::uri]] {
"/non-default-page/" {
pool $non_default_pool
}
"/non-default-page/*" {
pool $non_default_pool
}
default {
pool $default_pool
}
}
}
}
That kinda of thing works fine with a normal site. I also looked into doing that with a local traffic policy, but I got the same result. The intent is to keep left side of the URL the same, but I am not exactly sure if that is possible.