Forum Discussion
hooleylist
Dec 29, 2008Cirrostratus
Hi,
You can use a blank stream profile and the following iRule to replace a string with another string in the HTTP payload of a POST request. You'll need to create a custom HTTP profile with response chunking set to rechunk. You can check the STREAM::expression wiki page (Click here)
Aaron
when HTTP_REQUEST {
Check if the request is a POST, with a content type of text
if {[HTTP::method] eq "POST" && [HTTP::header value Content-Type] contains "text/xml"}{
Match the literal string "find" and replace it with "replace"
STREAM::expression {@find@replace@}
Enable the stream filter for this request only
STREAM::enable
} else {
Disable the stream filter by default
STREAM::disable
}
}
when STREAM_MATCHED {
This event is only included for debugging. You should remove the event after testing is complete.
log local0. "[IP::client_addr]:[TCP::local_port]: matched: [STREAM::match]"
}