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...
Sriram_129909
Nimbostratus
Nov 07, 2013Thank you very much for working on my iRule. However I have apparently figured out another way - meaning reading off of the payload in the HTTP_REQUEST itself. The following is the iRule. This works out well for me.
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]--NW--80--P2--[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] starts_with "/airlines/landingServlet" and [HTTP::method] eq "POST" } {
set payload [HTTP::payload]
set refid "unknown"
set refclickid "unknown"
foreach x [split [string tolower $payload] "&"] {
if { $x starts_with "refid=" } {
set refid [lindex [split $x "="] 1]
}
if { $x starts_with "refclickid=" } {
set refclickid [lindex [split $x "="] 1]
}
}
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]--NW--80--P2--pbrefid=$refid--pbrefclickid=$refclickid--C=[HTTP::header cookie]"
unset payload
}
}
when HTTP_RESPONSE {
if { [info exists F2C] and $F2C ne ""} {
HTTP::cookie insert name "F2C" value $F2C
HTTP::cookie expires F2C 630720000
unset -nocomplain 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