Gopi2018_350205
Jan 29, 2018Nimbostratus
How to check post parameter value?
I have a need to read a particular POST parameter and check its value for specific string and I have created a iRule as follows:
when HTTP_REQUEST_DATA {
set SSOPayload [string tolower [HTTP::payload]]
log local0. "SSOPayload : $SSOPayload"
if { not [IP::addr [IP::remote_addr] equals x.x.0.0/16] } {
if { [HTTP::method] equals "POST" }{
# Extract the entire HTTP request body and escape it to become a HTTP::uri string (for easier parsings)
set http_request_body "?[HTTP::payload [HTTP::header value "Content-Length"]]"
# Try to parse type value from the HTTP request body.
if { [catch { set type [URI::decode [URI::query $request_body type]] }] } {
log local0. "Type : $type"
if { not [type equals "abcdefgh"]}{
set html_content " FORBIDDEN "
HTTP::respond 403 content $html_content
} } }
}
Wanted to validate this iRule on the Syntax and also I didn't add Else condition in this, will this create any issues in executing this irule?