Forum Discussion
cymru81
Altocumulus
7 years agoirule help based on uri
Hi, ive done some searching on here but cannot find the exact help i need. We have the following scenario, can someone assist with an irule that will achieve this please? we have one VIP that ...
cymru81
Altocumulus
7 years agoIm sorry to move the goalposts but my brief has changed to the following now:
we have one VIP that hostname site.abc.com resolves to, if user visits https://site.abc.com/live it should redirect to pool "pool_live" changing the ur toi "/live_site". If user visits https://site.abc.com/test it should redirect to pool "pool_test" changing the uri to /test_site.
Is this achievable?
7 years ago
Hi cymru81,
iRule:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "site.abc.com" } {
switch -glob [string tolower [HTTP::uri]] {
"/live" {
HTTP::uri "/live_site"
pool pool_live
}
"/test" {
HTTP::uri "/test_site"
pool pool_test
}
}
}
}iRule with redirect:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "site.abc.com" } {
switch -glob [string tolower [HTTP::uri]] {
"/live" {
HTTP::redirect "https://site.abc.com/live_site"
pool pool_live
}
"/test" {
HTTP::redirect "https://site.abc.com/test_site"
pool pool_test
}
}
}
}If the HTTP::host is not site.abc.com, you can reject requests.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
