Forum Discussion
puluck
Cirrus
Sep 10, 2016irule 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 ...
Stanislas_Piro2
Cumulonimbus
Sep 10, 2016Hi,
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
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