Rodrigo_Silva_1
Aug 22, 2018Nimbostratus
iRule to do simple LB based only in HTTP host or uri.
Hello everyone!
There are several threads about this, but I didn't find any specifically related to a simple HTTP::host or ::uri LB.
Most of my projects so far are based only on WAF without any other license. I need the help of an iRule to do simple LB when receiving multiple HTTP requests that belong to different servers.
I use this iRule to do it:
when HTTP_REQUEST {
if { [HTTP::host] equals "example.com" } {
pool pool_example_port-80
snatpool snatpool_lan1
log local0. “example.com sent to pool_example-port from snatpool_lan1.”
}
if { [HTTP::uri] starts_with "/myApp1" } {
pool pool_app1_port-80
snatpool snatpool_lan2
log local0. “/myApp1 sent to pool_app1_port-port from snatpool_lan2.”
}
}
I was just wondering if any of you guys could help me improve it. Maybe there's something still left to do regarding best practices. For instance, it could be a best practice to return a status code when we're done with a function that allocates memory in other languages.