Maybe something like this:
Create a class of type string containing the hostnames for which you want the rule to run:
class BadServers {
"www.domain1.com"
"www.domain2.com"
}
to be used by this iRule:
rule rewrite_content {
when HTTP_REQUEST {
if {[matchclass [HTTP::host] $::BadServers]}{
set replace 1
}
when HTTP_RESPONSE {
if {$replace}{
if {[HTTP::header exists Content-Length]}{
set clen [HTTP::header Content-Length]
} else {
set clen 4294967295
}
if { $clength > 0 } {
HTTP::collect $clen
}
}
}
when HTTP_RESPONSE_DATA {
if {$replace}{
find beginning of data to keep
set xml_start [string first { if { $xml_start > 0 }{
set newPayload [string range [HTTP::payload] $xml_start end]
HTTP::payload replace 0 $clen $newPayload
}
HTTP::release
}
}
}
HTH
/deb