Forum Discussion
Sriram_129909
Nimbostratus
Nov 07, 2013iRule to check for a post body
I am trying to look for a post body element using http::payload. I got the following iRule from internet. But the http::collect line is obstructing my page.
iRule for P2 Project
when HTTP_REQUES...
Kevin_Stewart
Employee
Nov 07, 2013Try this version with some additional logging:
when HTTP_REQUEST {
Send the data using local7 facility <190>
if { not ([HTTP::cookie exists SITESERVER] ) } {
set F2C "[string range [AES::key 128] 15 end][string range [AES::key 128] 15 end]"
HTTP::cookie insert name "F2C" value $F2C
}
set cookie [HTTP::header cookie]
HSL::send [HSL::open -proto UDP -pool syslog_server_pool_1] "<190> [IP::client_addr] \[[clock format [clock seconds] -format "%d/%b/%Y:%H:%M:%S %z"]\] --[IP::local_addr]--[URI::path [HTTP::uri]][URI::basename [HTTP::uri]]--QS=[HTTP::query]--C=[HTTP::header cookie]--UA=[HTTP::header User-Agent]--CT=[HTTP::header "Content-type"]"
if { ( [HTTP::uri] contains "landingServlet" ) and ( [HTTP::method] equals "POST" ) } {
log local0. "Start collecting: [HTTP::header Content-Length]"
HTTP::collect [HTTP::header Content-Length]
}
}
when HTTP_RESPONSE {
if { [info exists F2C] and $F2C ne ""} {
HTTP::cookie insert name "F2C" value $F2C
unset -nocomplain F2C
}
}
when HTTP_REQUEST_DATA {
log local0. "Entering Request Data event"
set refid "unknown"
set refclickid "unknown"
foreach x [split [string tolower [HTTP::payload]] "&"] {
log local0. "x = $x"
if { $x starts_with "refid=" } {
set refid [lindex [split $x "="] 1]
log local0. "refid = $refid"
}
if { $x starts_with "refclickid=" } {
set refclickid [lindex [split $x "="] 1]
log local0. "refclickid = $refclickid"
}
}
HSL::send [HSL::open -proto UDP -pool syslog_server_pool_1] "<190> [IP::client_addr] \[[clock format [clock seconds] -format "%d/%b/%Y:%H:%M:%S %z"]\] --[IP::local_addr]--pbrefid=$refid--pbrefclickid=$refclickid--F2C=$F2C"
}
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