Forum Discussion
newf5learner_13
Mar 15, 2017Nimbostratus
irule for URI based redirection and to the pool..
Hi,
I'm looking for a short irule that helps in two ways.
- URI redirection
- Host based pool selection
I currently have two irules, I'm looking for one combined irule that serves the purpose.
Host to pool selection:
when HTTP_REQUEST {
switch -glob [ string tolower [HTTP::host]] {
"eng.page3.com" { pool page3_https_pool }
"eng.devpage3.pega.com" { pool devpage3_https_pool }
default { HTTP::respond 404 noserver }
}
URI based redirection:
when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/ClientService/BI-Integration/"} {
switch -glob [string tolower [HTTP::host]] {
"eng.page3.com" {HTTP::redirect "/clientapp[HTTP::uri]"}
}
}
}
Can someone help me with a irule that gives me the combined features of both. I don't like to use two separate irules on the same VIP, so checking if there is any better option.
Hi,
Just rearranging the code a bit may answer the question:
when HTTP_REQUEST { switch -glob [ string tolower [HTTP::host]] { "eng.page3.com" { if {[HTTP::uri] starts_with "/ClientService/BI-Integration/"} { HTTP::redirect "/clientapp[HTTP::uri]" } else {pool page3_https_pool } } "eng.devpage3.pega.com" { pool devpage3_https_pool } default { HTTP::respond 404 noserver } } }
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