Forum Discussion
rule http::host change
I asked a question yesterday which was answered but I guess I need something different.
I asked to redirect to the host name of the URL which would work, but I need to strip the blabla.com off the name. So in the below example going to mycool.stuff.com/bla/bla my redirect will go to redirect.newdomain.com/mycool.stuff.com/more/stuff. I want to strip off "stuff.com" from HTTP::name to end with redirect.newdomain.com/mycool/more/stuff Is this doable?when HTTP_REQUEST {
if { [active_members [LB::server pool]] < 1 } {
HTTP::redirect "https://redirect.newdomain.com/[HTTP::name]/more/stuff"
}
}
Thanks Joe
2 Replies
- Stefan_Klotz
Cumulonimbus
Hi Joe,
for sure is this doable (almost everything is possible with F5 BIG-IP and iRules).
Not sure where you have the [HTTP::name] from, as this is not a valid command, but your requirement should be solved with this iRule:
when HTTP_REQUEST { if { [active_members [LB::server pool]] < 1 } { set subdomain [substr [HTTP::host] 0 "."] HTTP::redirect "https://redirect.newdomain.com/$subdomain/more/stuff" } }Please give it a try and let me know if this is fine for you.
Ciao Stefan 🙂
- sundogbrew
Altocumulus
Stefan, YOU ROCK! I think that is exactly what I need. I need to test it but right now I am getting an error that it is trying to go to the right page. Thanks Joe
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