SNAT based on HTTP::HEADER (and SNAT)

Hi, we have implemented a virtual with two apache behind in round-robin balance. We need to configure a persistence based on a http::header “x-forwarded-for” ip original client.

The persistence works great. In addition we want to check if the ip client original it’s in specific subnet (like 172.16.0.0/16) and make a snat decision bases of the presence in the ip subnet.

Thanks!

regards Michele

Something like this (untested):

set origin_ip [HTTP::header "x-forwarded-for"]

if { $origin_ip == "" }
 return
elseif { [IP::addr $origin_ip equals 172.16.0.0/16] } {
 snatpool X }
else {
 snat x.x.x.x }