Do you really want to send the client a redirect? This will update the address bar in the browser and potentially prevent LTM from load balancing the requests if acme1.com and acme2.com don't resolve to a VIP address.
If so, here is a rough example of this ratio load balancing. I'm sure there are other ways to do it, but this is one method.
Aaron
when RULE_INIT {
Log debug messages (to /var/log/ltm)? 0 = no, 1 = yes.
set ::site_router_debug 0
Percentage of new requests to send to new site (valid values: integers from 0 - 10; with 1 being 10%, 5 being 50%, 10 being 100%)
set ::site1_ratio {5}
Initialise a counter for ratio load balancing between the legacy and new site.
(this value shouldn't be changed)
set ::counter 0
}
when HTTP_REQUEST {
Send first X out of 10 requests to the new site. Then send next 10 minus X requests to the legacy site.
if {$::counter < $::site1_ratio}{
if {$::site_router_debug}{log local0. "Counter < max: $::counter < $::site1_ratio. Selected site1."}
Redirect to a URL. Set headers to prevent caching of response.
HTTP::respond 302 \
"Location" "https://site1" \
"Connection" "Close" \
"Cache-Control" "no-cache" \
"Pragma" "no-cache"
} else {
if {$::site_router_debug}{log local0. "Counter > max: $::counter > $::site1_ratio. Selected site2."}
Redirect to a URL. Set headers to prevent caching of response.
HTTP::respond 302 \
"Location" "https://site2" \
"Connection" "Close" \
"Cache-Control" "no-cache" \
"Pragma" "no-cache"
}
Increment the counter for ratio load balancing
incr ::counter
If counter is over the max, reset it to 0
if {$::counter > 10}{
set ::counter 0
if {$::site_router_debug}{log local0. "Counter: $::counter, resetting to 0"}
}
}