Hi, i’m having a problem with some (basic) aflex traffic redirection on a virtual server that I’m trying to use.
I’m trying to match certain subnet ranges of users to a prioritised server pool (sg2-80), but to not prevent them from connectivity if that prioritised pool goes down for some reason, and send the majority of traffic to the sg1-80 pool. (traffic to real servers is http over port 80 with ssl terminated at a10).
I’ve applied the aflex template to the virtual server, and at the moment it seems to be matching all traffic to the default in the switch statement regardless of the other cases matching before it (so no traffic is going to sg2) if i take away the “default” then traffic it works but won’t catch any cases that dont match the specific ruleset (if it’s not in 10.10.0.0/16 in this case).
In the virtual server I haven’t bound any service group (the aflex template seems to take care of service group mapping) but if i do then again it seems to ignore the custom matching for specific subnets in the 10.10.0.0/16 range (outside those sent to service group 1)
for reference we have a a10 thunder series 3030s.
I have changed the ip addresses / urls in the aflex code below for privacy, but essentially i’m using these sort of pattern matching rules:
\#\# Redirect end-user connections based on ip address / host header statements on ipv4
\# work out if sg2-80 pool is down or if request is specifically for sg2-80 pool on a separate cname alias in host header
when HTTP\_REQUEST \{
if \{[LB::status pool sg2-80] == "down" \} \{ pool sg1-80
\} elseif \{ [HTTP::host] contains "alternate.websitename.co.uk" \} \{ pool sg2-80 \}
# matching of internal user subnets to redirect traffic as appropriate
switch [IP::client\_addr] \{
10.10.10.0/24 \{ pool sg1-80 \}
10.10.28.0/22 \{ pool sg1-80 \}
10.10.60.0/24 \{ pool sg1-80 \}
10.10.0.0/16 \{ pool sg2-80 \}
192.168.0.0/24 \{ pool sg2-80 \}
default \{ pool sg1-80 \}
\}
\#\#\#\# at this point I could add ( if \{ [HTTP::host] contains "default.websitename.co.uk" \} \{ pool sg1-80 \} ) to catch outliers which might be a solution but it’s not ideal as it requires working out all the outlying cases… when it would be better to just have a catch all at the bottom
#### alternately I could try using an if{}elseif{} for all tests which may work, but the switch statement is recommended and is certainly more readable as here : aFleX Scripting Language Optimization | A10 Networks
}
Thanks for your help, apologies if some of this doesn’t entirely make sense at first glance!