Forum Discussion
danra_139044
Altostratus
Mar 25, 2014iRule: 'Switch -glob' does not work with HTTP::payload, it works using 'if-elseif' logic.
Anyway how to use 'switch -glob' to search HTTP::payload?
It works with 'if-elseif' logic.
Also, is the HTTP::release advisable to add?
when HTTP_REQUEST {
if { [HTTP::method] equals "POST" }{
HTTP::collect [HTTP::header Content-Length]
}
}
when HTTP_REQUEST_DATA {
switch -glob [HTTP::payload] {
apple {
pool apple_pool
}
orange {
pool orange_pool
}
}
}
1 Reply
- Kevin_Stewart
Employee
It will work, but I'm guessing you need to allow for some padding:
when HTTP_REQUEST { if { [HTTP::method] equals "POST" }{ HTTP::collect [HTTP::header Content-Length] } } when HTTP_REQUEST_DATA { switch -glob [HTTP::payload] { "*apple*" { pool apple_pool } "*orange*" { pool orange_pool } } }You shouldn't need to issue the HTTP::release command because you're explicitly defining the amount of payload to collect using the Content-Length header.
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