Walter_WorkAcct
Dec 13, 2021Altostratus
iRule to forward to subsites
In the following code, I want test1, test2 and test3 to route to the pool "pool_subsites_8443" and serve pages and all others to simply go to the main website. However, if you put in website/~test4 you simply get a 404. How can I have this go to the main website instead of return a 404?
when CLIENT_ACCEPTED {
set hsl [HSL::open -publisher /Common/hsl_publisher]
}
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/~" } {
HSL::send $hsl "The URI is [HTTP::uri] contains a tilde and will be sent to staff server."
switch -glob [HTTP::uri] {
"/~test1*" -
"/~test2*" -
"/~test3*"
{
# URI ends with a specific username
# All these cases use the same action.
pool pool_subsites_8443
}
default {
pool pool_main_8443
}
}
} else {
return
}
}
when CLIENT_CLOSED {
unset hsl
}