Here is the code that I have in place. I believe its the regex that isn't working as nothing much happens after that.
I have also looked at the stream profile, but we already use stream profiles on some of the Virtual Servers that this will be applied to.
when HTTP_REQUEST {
if { [HTTP::version] eq "1.1" } {
if { [HTTP::header is_keepalive] } {
HTTP::header replace "Connection" "Keep-Alive"
}
HTTP::version "1.0"
log local0. "HTTP version reset to 1.0"
}
}
when HTTP_RESPONSE {
Ensure all of the HTTP response is collected
if { [HTTP::header exists "Content-Length"] } {
set content_length [HTTP::header "Content-Length"]
} else {
set content_length 1000000
}
if { $content_length > 0 } {
HTTP::collect $content_length
log local0. "Content-Length: $content_length"
}
}
when HTTP_RESPONSE_DATA {
Find the HTML comments
set indices [regexp -all -inline -indices {} [HTTP::payload]]
Replace the comments with spaces in the response
log local0. "Indices: $indices"
foreach idx $indices {
set start [lindex $idx 0]
set len [expr {[lindex $idx 1] - $start + 1}]
log local0. "Start: $start, Len: $len"
HTTP::payload replace $start $len [string repeat " " $len]
}
}
Many thanks
Ant