Forum Discussion
Mike_129800
Nimbostratus
Jul 07, 2013Redirect to different host and port based on URL
Hi
We just installed two F5 BigIP (LTM) devices so I am new to iRules, how would I setup the following redirect based on the incoming URL?
https://host.com/product1 redirect to https://host...
Mike_129800
Nimbostratus
Jul 08, 2013Thank you, so something like this for the iRule:
when HTTP_REQUEST {
switch [string tolower [HTTP::uri]] {
/sto { set newhost "sto.domain";set newnode "200.200.200.101" }
/cph { set newhost "cph.domain";set newnode "200.200.200.102" }
/bru { set newhost "bru.domain";set newnode "200.200.200.103" }
/jnb { set newhost "jnb.domain";set newnode "200.200.200.104" }
default {
do something
}
}
HTTP::header replace Host $newhost
HTTP::uri [string map -nocase {sto WOS} [HTTP::uri]]
HTTP::uri [string map -nocase {cph WOS} [HTTP::uri]]
HTTP::uri [string map -nocase {bru WOS} [HTTP::uri]]
HTTP::uri [string map -nocase {jnb WOS} [HTTP::uri]]
node $newnode 6500
}
I want to only replace part of the URL i.e. sto, cph, bru, jnb with WOS will the above work for that?
The set newnode "200.200.200.101" should that be the IP of new host or is it something else?
What is the virtual bar config for in the above example?
I am setting this up via the GUI.
Thanks,
Mike
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