Forum Discussion
nrg2brn_163859
Nimbostratus
Mar 12, 2015beginner question - will this redirect work? or am I going to redirect right out of the f5?
im going to squeeze these 4 redirects on top of the existing pool switching Irule, but I dont really understand (yet) how the f5 processes Irules. Will the redirect kick the path right out of the f5 ...
Michael_Jenkins
Cirrostratus
Mar 12, 2015So I updated your iRule as I would do in my own environment. When doing an
HTTP::redirect, you'll need to call the return command so the iRule stops processing that request. Otherwise you may run into issues later on in the iRule (yours would be fine, except that since it's a redirect, setting the pool is moot as the request will not make it to the server (it'll send back a redirect after the HTTP_REQUEST rule(s) finish).
What I added was that if none of those redirectable urls were the requested one, do your switch and then set the pool as expected. That should get you the experience you are looking for.
The other option would have been to separate the two switch statements completely and add a
return command after each of the HTTP::redirect comamnds.
when HTTP_REQUEST {
switch [string tolower "[HTTP::host][HTTP::uri]"] {
"ecms.epa.gov/erma/login.htm?action-search" {
HTTP::redirect "http://ecms.epa.gov/erma2/login.htm?action=search"
}
"ecms.epa.gov/rradmin/login.htm?action=iss" {
HTTP::redirect "http://ecms.epa.gov/erma2/login.htm?action=registration"
}
"ecms.epa.gov/rradmin/login.htm?action=orgadmin" {
HTTP::redirect "http://ecms.epa.gov/erma3/login.htm?action=orgadmin"
}
"ecms.epa.gov/erma/login.htm?action=recordsadmin" {
HTTP::redirect "http://ecms.epa.gov/erma3/login.htm?action=recordsadmin"
}
default {
switch -glob -- [string tolower [HTTP::path]] {
"/rradmin*" {
/rradmin URI
log local0. "[IP::remote_addr]: Request for /rradmin sent to pool pool_rradmin_ecms.gov_new_443"
pool pool_rradmin_ecms.epa.gov_443
}
"/erma2*" {
/erma2 URI
log local0. "[IP::remote_addr]: Request for /erma2 sent to pool pool_erma2_ecms.epa.gov_new_443"
pool pool_erma2_ecms.epa.gov_443
}
"/erma3*" {
/erma3 URI
log local0. "[IP::remote_addr]: Request for /erma3 sent to pool pool_erma3_ecms.epa.gov_new_443"
pool pool_erma3_ecms.epa.gov_443
}
"/erma*" {
/erma URI
log local0. "[IP::remote_addr]: Request for /erma sent to pool pool_erma_ecms.epa.gov_new_443"
pool pool_erma_ecms.epa.gov_443
}
default {
everything else URI
log local0. "[IP::remote_addr]: Default ecms.epa.gov sent to pool_default_ecms.epa.gov_new_443"
pool pool_default_ecms.epa.gov_443
}
}
}
}
}
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