Forum Discussion
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 y...
Hi Walter_WorkAcct,
Can you try this iRule?
when CLIENT_ACCEPTED {
set hsl [HSL::open -publisher /Common/hsl_publisher]
}
when HTTP_REQUEST {
set status 0
if { [HTTP::uri] starts_with "/~" } {
set status 1
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 HTTP_RESPONSE {
if { $status && [HTTP::status] == 404 } {
HTTP::redirect "https://example.com"
}
}
when CLIENT_CLOSED {
unset hsl
}
Walter_WorkAcct
Dec 16, 2021Altostratus
Initially I thought this fix was working correctly but there is a strange bug that if for example I am in example.com/~test1 and go to example.com/~test9 (test9 exists but is not in the select statement) it doesn't redirect and serves a page that I am not 100% sure where it is coming from. Still troubleshooting.
It is like it redirects to www.example.com but is serving the data with a subdirectory from this staff server.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects