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. ...
nitass
Employee
Jul 06, 2013just another example.
root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm virtual bar
ltm virtual bar {
destination 172.28.20.111:80
ip-protocol tcp
mask 255.255.255.255
pool foo
profiles {
http { }
tcp { }
}
rules {
qux
}
source 0.0.0.0/0
source-address-translation {
type automap
}
vlans-disabled
}
root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm pool foo
ltm pool foo {
members {
200.200.200.101:80 {
address 200.200.200.101
}
200.200.200.111:80 {
address 200.200.200.111
}
}
}
root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm rule qux
ltm rule qux {
when HTTP_RESPONSE {
if { [HTTP::is_redirect] } {
HTTP::header replace Location [string map {MyHost01.domainname.com newHost.com MyHost02.domainname.com newHost.com} [HTTP::header Location]]
}
}
}
original response
[root@ve11a:Active:Changes Pending] config curl -I http://200.200.200.101/something
HTTP/1.1 302 Found
Date: Sat, 06 Jul 2013 08:04:13 GMT
Server: Apache/2.2.3 (CentOS)
Location: http://MyHost01.domainname.com/somethingelse
Connection: close
Content-Type: text/html; charset=iso-8859-1
[root@ve11a:Active:Changes Pending] config curl -I http://200.200.200.111/something
HTTP/1.1 302 Found
Date: Sat, 06 Jul 2013 08:04:11 GMT
Server: Apache/2.2.3 (CentOS)
Location: http://MyHost02.domainname.com/somethingelse
Content-Type: text/html; charset=iso-8859-1
response after passing bigip
[root@ve11a:Active:Changes Pending] config curl -I http://172.28.20.111/something
HTTP/1.1 302 Found
Date: Sat, 06 Jul 2013 08:04:26 GMT
Server: Apache/2.2.3 (CentOS)
Location: http://newHost.com/somethingelse
Content-Type: text/html; charset=iso-8859-1
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