Forum Discussion
atoth
Cirrus
Sep 24, 2016http::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 ...
Kai_Wilke
MVP
Sep 24, 2016Hi Atoth,
I don't think that a data-group is the right choice for this task. The possible values are not that much and are also rather static.
But you may try the syntax below. It uses the
[switch] command with -glob *[01234] and *[56789] patterns to route your request based on the last digit of the given header value...
when HTTP_REQUEST {
switch -glob -- [HTTP::header value abc] {
"*[01234]" { node 1.1.1.1 443 }
"*[56789]" { node 2.2.2.2 443 }
default { pool default_pool }
}
}
Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
