If I understand you correctly, you want requests to the search results page to return a 404 (and the search results content), when it normally returns a 200. If so, the following should work (modify as required):
when HTTP_REQUEST {
if { [HTTP::uri] equals "/" } {
set rewrite_status 1
}
}
when SERVER_CONNECTED {
if { [info exists rewrite_status] } {
unset rewrite_status
TCP::collect
}
}
when SERVER_DATA {
if { [regsub -all -nocase "200 OK" [TCP::payload] "404 Not Found" newdata] } {
TCP::payload replace 0 [TCP::payload length] $newdata
}
TCP::release
}
The basic idea is that since the HTTP::status command is read only, you need to write to the (TCP) data below layer 7. So using the SERVER_CONNECTED command and then a subsequent TCP::collect, you can see the full TCP response (HTTP status, version, headers, and HTTP payload) and change whatever you need. In this case, if the request URI matches what you're looking for, you'll remap the "200 OK" to "404 Not Found" in the TCP response.