Forum Discussion
sundogbrew
Altocumulus
Jul 30, 2014Irule redirect question
So I wrote a real simple Irule that redirects if all the nodes are out of the pool
when HTTP_REQUEST { if { [active_members [LB::server pool]] == 0 } { HTTP::redirect "https://blablabla.com" } }
My question is can an I rule take info out of the URL or URI and redirect based on that?
So say my URL is https://funnyapplication.blabla.com and there are no nodes in the pool, can my Irule redirect to say Https://replacementurl/funnyapplication.bla.com where it grabs some piece of the url and puts it in the URI of the redirect path? Thanks as always! Joe
3 Replies
- Kevin_Stewart
Employee
Absolutely.
when HTTP_REQUEST { if { [active_members [LB::server pool]] < 1 } { HTTP::redirect "https://replacementurl/[HTTP::host][HTTP::uri]" } } - sundogbrew
Altocumulus
Hey Kevin, Thanks for your help. I'm not quite there yet...
So that works to replace the the URL but I need to take the end off of it. So my URL is https://pto.something.com/bla/bla/bla What you wrote works but my problem is I only need the pto part. So my redirect should be https://redirect.something.com/pto/bla/bla is this still doable? Thanks Joe - OTS02
Cirrus
Just for my own edification, why would you not simply configure that in the fallback host in the http profile?
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