Forum Discussion
beginner 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 and to the servers? we do need these redirects to land into one of the below pools.... or will the redirect realize it needs to go to one of the pools below?
when HTTP_REQUEST {
redirects:
if {[HTTP::host] equals "ecms.epa.gov/erma/login.htm?action-search"}{HTTP::redirect "http://ecms.epa.gov/erma2/login.htm?action=search"}
if {[HTTP::host] equals "ecms.epa.gov/rradmin/login.htm?action=iss"}{HTTP::redirect "http://ecms.epa.gov/erma2/login.htm?action=registration"}
if {[HTTP::host] equals "ecms.epa.gov/rradmin/login.htm?action=orgadmin"}{HTTP::redirect "http://ecms.epa.gov/erma3/login.htm?action=orgadmin"}
if {[HTTP::host] equals "ecms.epa.gov/erma/login.htm?action=recordsadmin"}{HTTP::redirect "http://ecms.epa.gov/erma3/login.htm?action=recordsadmin"}
Check the requested path with wildcard matching switch -glob [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 } } }
1 Reply
- Michael_Jenkins
Cirrostratus
So I updated your iRule as I would do in my own environment. When doing an
, you'll need to call theHTTP::redirect
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).returnWhat 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
command after each of thereturn
comamnds.HTTP::redirectwhen 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
* 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