Forum Discussion
EBS_Support_258
Dec 25, 2008Nimbostratus
Can I use irule to change uri based on selected pool member ?
Hello,
I have 4 nodes as pool members
192.168.9.179,192.168.9.180,192.168.9.181,192.168.9.182
and 1 Virtual Server 192.168.9.199
When client use the application, URL for this application is
http://192.168.9.199/report/report.php?param=vserver
Then F5 will load balance this traffic to 4 pool members in Round Robin algorithm.
The question is : after load balancing, this HTTP request have to change it's URI depend on selected pool member
if go to pool member 192.168.9.179, the uri have to change to http://192.168.9.179/report/report.php?param=server1
if go to pool member 192.168.9.180, the uri have to change to http://192.168.9.180/report/report.php?param=server2
if go to pool member 192.168.9.181, the uri have to change to http://192.168.9.181/report/report.php?param=server3
if go to pool member 192.168.9.182, the uri have to change to http://192.168.9.182/report/report.php?param=server4
How can I use irule to match this requirement ?
Thanks,
- hooleylistCirrostratusHi,
when HTTP_REQUEST_SEND { Parse the parameter value for my_param set my_param_value_orig [URI::query [clientside {HTTP::uri}] "my_param"] Check if the requested URI contains the parameter (called my_param in this example) to replace if {[string length $my_param_value_orig]}{ Get the alias based on the selected server switch [IP::server_addr] { "192.168.9.179" { set my_param_value_new "server1"} "192.168.9.180" { set my_param_value_new "server2"} "192.168.9.181" { set my_param_value_new "server3"} "192.168.9.182" { set my_param_value_new "server4"} default { Take some default action? } } Replace the my_param value with the selected node alias clientside {HTTP::uri [string map "$my_param_value_orig $my_param_value_new" [clientside {HTTP::uri}]]} } }
if {[IP::addr [IP::server_addr] equals 192.168.9.179]}{ set my_param_value_new "server1" } elseif {[IP::addr [IP::server_addr] equals 192.168.9.180]}{ set my_param_value_new "server2" ...
class my_server_aliases { "192.168.9.179 server1", "192.168.9.180 server2", "192.168.9.181 server3", "192.168.9.182 server4", }
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