Forum Discussion
irule for load balance traffic based on query string
Hello team ,
I am looking for irule to loadbalance traffic based on query string from host header .For example
www.example.com?silo=1 this particluar request need to go to webserever 1 of my http_pool ,similarly www.abc.com?silo=2 needs to go to webserver 2 on my http_pool .All sites are coming to same VIP address ,but requirement here is to load balance based query string in host header .I did try HTTP::query string commands in irule ,but its not working .
silo=1 will be webserver1 silo=2 will be webserver2 silo=3 will be webserver3
Regards puluck
1 Reply
- Stanislas_Piro2
Cumulonimbus
Hi,
this irule read the server in the query parameter and search it's IP in the static::web servers array
when RULE_INIT { array set static::webservers { 1 1.1.1.1 2 1.1.1.2 3 1.1.1.3 } } when CLIENT_ACCEPTED { set default_pool [LB::server pool] } when HTTP_REQUEST { set target_member [URI::query [HTTP::uri] silo] if {!($target_member eq "") && [info exists static::webservers($target_member)} { pool $default_pool member $static::webservers($target_member) } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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