Forum Discussion
waterfall_10467
Jul 19, 2012Altostratus
Help for when_http_response
when HTTP_REQUEST timing on priority 100 {
Check the requested path with wildcard matching
switch -glob [HTTP::path] {
...
nitass
Jul 20, 2012Employee
is this codeshare applicable?
HTTP Payload Collection by Deb
https://devcentral.f5.com/wiki/iRules.HTTPPayloadCollection.ashx
e.g.
[root@ve10:Active] config b virtual bar list
virtual bar {
snat automap
destination 172.28.19.79:80
ip protocol 6
rules myrule
profiles {
http {}
tcp {}
}
}
[root@ve10:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
set flag 0
set path [HTTP::path]
switch -glob $path {
"/HARDWARE*" {
set flag 1
set collected 0
if { [HTTP::version] eq "1.1" } {
if { [HTTP::header is_keepalive] } {
HTTP::header replace "Connection" "Keep-Alive"
}
HTTP::version "1.0"
}
pool HTTP_active
}
default {
do someting
}
}
}
when HTTP_RESPONSE {
if {$flag == 0} { return }
if { [HTTP::header exists "Content-Length"] } {
set content_length [HTTP::header "Content-Length"]
} else {
set content_length 0
}
if { $content_length > 0 && $content_length < 1048577 } {
set collect_length $content_length
} else {
set collect_length 1048576
}
if { $collect_length > 0 } {
HTTP::collect $collect_length
}
}
when HTTP_RESPONSE_DATA {
log local0. "client [IP::client_addr]:[TCP::client_port] | server [IP::remote_addr]:[TCP::remote_port] | path $path | payload [HTTP::payload]"
HTTP::release
set collected [expr {$collected + $collect_length}]
set remaining [expr {$content_length - $collected}]
if { $remaining > 0 } {
if { $remaining < $collect_length } {
set collect_length $remaining
}
HTTP::collect $collect_length
}
}
}
[root@ve10:Active] config tail -f /var/log/ltm
Jul 20 21:02:20 local/tmm info tmm[5111]: Rule myrule : client 192.168.206.55:51246 | server 200.200.200.101:80 | path /HARDWARE/test.html | payload hello world
Recent Discussions
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