Forum Discussion
Pool and path switching by XML content in Request
Hi,
a customer asked for an irule at our F5 bigip (11.5.1) to switch server targets depending on the content of the actual request (POST XML) in the following way:
if in a special key in the XML has value "a" go to pool_a and rewrite URL to "/abc",
if that key is "b" go to pool_b and rewrite URL to "/abc",
else go to pool_a and rewrite URL to "/xyz"
I built something like this, which saves fine but before releasing it, I wanted to ask if this would solve the request/work, is logically correct and if there must be any escaping of the strings.
when HTTP_REQUEST {
if { [HTTP::header exists Content-Length] } {
HTTP::collect [HTTP::header Content-Length]
}
}
when HTTP_REQUEST_DATA {
if { [HTTP::header exists Content-Length] } {
if { [HTTP::payload] contains "a" } then {
HTTP::path "/abc"
pool pool_a
} elseif { [HTTP::payload] contains "b" } then {
HTTP::path "/abc"
pool pool_b
} else {
HTTP::path "/xyz"
pool pool_a
}
}
}
1 Reply
- hfi_254510
Nimbostratus
And of course I would like to ask if this could be optimized? (besides not doing it at all, I'm aware that this is not a recommended scenario for an irule from a performance perspective)
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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