Forum Discussion

habib_Khan's avatar
habib_Khan
Icon for Nimbostratus rankNimbostratus
Jun 08, 2016

stream profile-- using irule need to replace text

when i access a url, below is the page content displayed. InstallApplication

 

I am using stream profile with irule to replace the text "InstallApplication" with some garbage text. I tried below url with stream profile, this is not working. Kindly help.

 

when HTTP_REQUEST {

 

Disable the stream filter for client requests

STREAM::disable HTTP::header remove "Accept-Encoding" } when HTTP_RESPONSE {

 

Enable the stream filter for XML responses only

if { [HTTP::header value Content-Type] contains "text/xml"} {

 

Replace 'InstallApplication' with 'MisMatch000'

STREAM::expression {@InstallApplication@MisMatch000@} STREAM::enable } }

 

2 Replies

  • Hi,

    I regularly use similar irule that do not rely on stream profiles :

    when HTTP_REQUEST {
        HTTP::header remove "Accept-Encoding"
    }
    
    when HTTP_RESPONSE {
        if { [HTTP::header Content-Type] contains "text/xml" } {
            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
            }
        }
    }
    when HTTP_RESPONSE_DATA { 
        HTTP::payload replace 0 $content_length [string map "InstallApplication" "MisMatch000" [HTTP::payload]]
        HTTP::release
    }
    
  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    They are HTML-encoded and you can treat those characters just as a string.