Forum Discussion
Kevin_Jones_505
Feb 08, 2006Historic F5 Account
HTTP_REQUEST and POSTs
I'd like an iRule that acts based on values in a POST. Can I use the HTTP_REQUEST event, or would I need to use a CLIENT_ACCEPTED and combine it with an HTTP::method?
thanks.
- JRahm
Admin
when HTTP_REQUEST { if { [HTTP::method] equals "POST" } } }
- That will tell you whether it is a POST request or not. If you want to act on the data within the POST, you will have to issue a collect and work with the HTTP::payload value in the HTTP_REQUEST_DATA event.
when HTTP_REQUEST { if { [HTTP::method] equals "POST" } { if { [HTTP::header exists "Content-Length"] } { set content_length [HTTP::header "Content-Length"] } else { set content_length 4294967295 } if { $content_length > 0 } { this will trigger the HTTP_REQUEST_DATA event when all the POST data has arrived. HTTP::collect $content_length } } } when HTTP_REQUEST_DATA { check the HTTP::payload for it's contents. if { [HTTP::payload] contains "somevalue" } { do something here... } }
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