Forum Discussion
Ube_34341
Nimbostratus
Aug 02, 2013Getting values of json from POST payload not working
Hi Guys,
strange behaviour down here. I'm trying to extract value of parameters from the payload of a POST and send with HSL using the below irule with no success at all: the variables are empty...
Kevin_Stewart
Employee
Aug 02, 2013At a minimum you probably want to use the HTTP::collect command and HTTP_REQUEST_DATA event to capture the payload:
when HTTP_REQUEST {
if { ( [HTTP::method] equals "POST" ) and ( [string tolower [HTTP::uri]] contains "keepal" ) } {
HTTP::collect [HTTP::header Content-Length]
}
}
when HTTP_REQUEST_DATA {
set payload [HTTP::payload]
All collected payload is available here...
}
You're most likely not seeing the payload in the HTTP_REQUEST event because it exceeds a single TCP packet. Using HTTP::collect tells the iRule to collect and buffer the payload (up to the specified amount) and make it available in the HTTP_REQUEST_DATA event. Take a look at the wiki for both of these (command and event) for more thorough implementations.
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