Forum Discussion
arripay_6298
Nimbostratus
Jun 28, 2016Redirect Problem
Hi,
using a single and pool with multiple hosts, trying to do a redirect based on host name and uri match using the following.
when HTTP_REQUEST {
log local0. "Request: [HTTP::host][HTTP::ur...
Samir_Jha_52506
Noctilucent
Jun 28, 2016Avoid multiple uri in same condition. I believe
matchclass will be good option.
Use below irule.
class redirectURIs {
/abc/book
/manage/pqr
/checkin/xyz
}
when HTTP_REQUEST {
if { [matchclass [HTTP::uri] contains redirectURIs] } {
HTTP::redirect "http://www.website2.com"
}
}
arripay_6298
Nimbostratus
Jun 28, 2016Thanks THi, really appreciate you help, proper stuck on this. I have had amend slightly as the devs have changed the redirect to a page on the same host. I cant get access to the f5 at the moment but I think this what I have, no change of behaviour. Will add tolower when I can get on machine. Any further help greatly appreciated.
when HTTP_REQUEST {
log local0. "Request: [HTTP::host][HTTP::uri]"
if {([HTTP::uri] contains "app/commission") or
([HTTP::uri] contains "api/tickets") or
([HTTP::uri] contains "api/manageclasses") or
([HTTP::uri] contains "app/trainer") or
([HTTP::uri] contains "app/target") }
{
HTTP::redirect "[HTTP::host]//restricted"
}
}
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