Forum Discussion
redirect back to client ONLY IF URI contains /apps
I want to create an irule redirect that would only be sent back to the client if the URI contains a "/apps". For example, if user browsers to site1.abc.com...traffic is handled normally by F5 and sent to site1 pool, if user browses to site1.abc.com/assets...traffic is handled normally by F5 and sent to site1 pool. But if user browses to site1.abc.com/apps, then I want the irule to send back redirect to client to go to site2.abc.com/apps.
Below is a simple redirect irule that I got from DevCentral...and I modified it a bit to fit my situation. Would this irule redirect the client's request for "site1.abc.com/apps" to "site2.abc.com/apps" ?
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "site1.abc.com/apps" } {
HTTP::redirect "http://site2.abc.com/apps"
}
}
- JG
Cumulonimbus
when HTTP_REQUEST { switch -glob -- [string tolower [HTTP::path]] { "/apps" - "/apps/" { HTTP::redirect "http://site2.abc.com/apps/" } } }
Recent Discussions
Related Content
* 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