Irule to set a pool on the basis of value in X-forwarded-for
Hi ,
I am setting up something, in which the requirement is I need to decide a pool on the basis of ip listed in X-forwarded-for header in the http request.
For this I configured 3 data group list named test_ipranges_1 , test_ipranges_2 & test_ipranges_3. But when i am writing the irule, it is giving me error, can someone help me out with this. Below is the code that i have written:
when HTTP_REQUEST {
if { class match -value [HTTP::header "X-forwarded-for"] equals test_ipranges_1 } {
pool pool1
} elseif { class match -value [HTTP::header "X-forwarded-for"] equals test_ipranges_2 } {
pool pool2
} elseif { class match -value [HTTP::header "X-forwarded-for"] equals test_ipranges_3 } {
pool pool3
} else {
pool default
}
}