atoth
Sep 24, 2016Cirrus
http::header value question
I'm trying to write an irule where based on the value of a custom http header it redirects to different servers. Its a little clunky, but when I figure where I'm going I put the values in datagroup with a matchclass statement. The header abc is a string with bunch of numbers, and the irule looks at the last number and redirects based on that. Anyway, this is what I have, and unfortunately, after trying a bunch of things, I still haven't been able to save it without syntax errors.
when HTTP_REQUEST {
if { ([HTTP::header value abc] ends_with "1") OR ([HTTP::header value abc] ends_with "2") OR ([HTTP::header value abc] ends_with "3") OR ([HTTP::header value abc] ends_with "4") OR ([HTTP::header value abc] ends_with "5")} {
node 1.1.1.1 443
} elseif { ([HTTP::header value abc] ends_with "6") OR ([HTTP::header value abc] ends_with "7") OR ([HTTP::header value abc] ends_with "8") OR ([HTTP::header value abc] ends_with "9") OR ([HTTP::header value abc] ends_with "0")} {
node 2.2.2.2 443
} else {
default_pool
}
}