Forum Discussion
Sylvain_85827
Cirrus
Jul 02, 2013Rewrite URL based on selected node for load-balancing
Dears iRules Gurus and community,
Once again I need your help ^^ I'm wondering how to rewrite an URL of HTTP requests (IPP in fact) depending on the node chosen for load-balancing the traffic. ...
Kevin_Stewart
Employee
Jul 06, 2013Maybe something like this:
when HTTP_RESPONSE {
if { [HTTP::is_redirect] } {
set host_new "newHost.com"
set uri_old [string tolower [HTTP::header Location]]
if { [scan $uri_old {%*[http://|https://]%[^/]} host_old] } {
set map_exp "set uri_new \[string map {$host_old $host_new} $uri_old\]"
eval $map_exp
HTTP::header replace Location $uri_new
}
}
}
Using the scan and string map commands are just a few ways to do all of this.
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