Forum Discussion

CraigMo's avatar
CraigMo
Icon for Nimbostratus rankNimbostratus
Dec 16, 2014

conditional stream irule

Currently the following irule is successful for some of the applications but breaks others:

 

when HTTP_REQUEST { Disable the stream filter for client requests STREAM::disable Disable compression HTTP::header remove "Accept-Encoding" }

 

when HTTP_RESPONSE { if {[HTTP::host] contains "connect-q.abbvie.net" } { if {[HTTP::uri] contains "layouts/15/LstSetng.aspx"} { Disable the stream filter for server responses STREAM::disable Enable the stream filter for text responses only if {[HTTP::header value Content-Type] contains "text"}{ Replace 'old_text' with 'new_text' STREAM::expression {@[Hh][[Tt][Tt](/|&.x2f;){2}@} Enable the stream filter for this response only STREAM::enable } } } }

 

I was wondering if someone would be able to provide the syntax such that if the uri contains "/lstsetng.aspx" then perform the stream rewrite otherwise do not perform the stream rewrite.

 

Thanks,

 

2 Replies

  • Try this. It should help out. Can't test it at the moment to verify, but I think it'll work.

    when HTTP_REQUEST { 
         Disable the stream filter for client requests 
        STREAM::disable 
         Disable compression 
        HTTP::header remove "Accept-Encoding" 
    
         set variables here because you can't access these in HTTP_RESPONSE
        set hostLower [string tolower [HTTP::host]]
        set pathLower [string tolower [HTTP::path]]
         The PATH is the URI without the query string part
    }
    
    when HTTP_RESPONSE { 
        if { ($hostLower contains "connect-q.abbvie.net") && ($pathLower contains "/lstsetng.aspx")} {
             Enable the stream filter for text responses only 
            if {[HTTP::header value Content-Type] contains "text"}{ 
                 Replace 'old_text' with 'new_text' 
                STREAM::expression {@[Hh][[Tt][Tt]Pp(/|&.x2f;){2}@} 
    
                 Enable the stream filter for this response only 
                STREAM::enable 
            }
        } 
    }
    
  • Thanks for the response. I will give it a try and reply with results.