Forum Discussion
Al-Mutlaq_21911
Nimbostratus
Aug 26, 2015direct traffic based on information from the XML request
Dear All,
I need a solution on IRULE for example to solve the following scenario:
I have 10 servers that will receive XML requests. the unique ID in each XML request will be a number such ...
Kevin_Stewart
Employee
Aug 27, 2015Okay, well there's an XML xpath way to do this with the XML_CONTENT_BASED_ROUTING event and an XML profile, but for such a small set of data that's probably more complicated than a single string parse.
when HTTP_REQUEST {
if { [HTTP::header Content-Type] contains "xml" } {
HTTP::collect [HTTP::header Content-Length]
}
}
when HTTP_REQUEST_DATA {
set number [string trim [findstr [HTTP::payload] "" 8 ""]]
enable for testing
log local0. "number = $number"
now that you have the number you can add the switch code to find the last digit
}I'm making an assumption of course that the XML request has a Content-Type header with the word "xml" in it, and I'm also not accounting for what might happen if the request isn't xml, but I hope this gets you going in the right direction.
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
