Forum Discussion

Marty_Baxter_14's avatar
Marty_Baxter_14
Icon for Nimbostratus rankNimbostratus
May 27, 2014

Help modifying HTML content with an iRule

Hello,

 

I need help changing the HTML in the http response. Specifically in the line below I need to change the ../ to /es/aw/fleet/

 

 

I have tried the following code which did not work (no errors - but content was not modified): when HTTP_REQUEST {

 

 disable server side compression         
HTTP::header remove Accept-Encoding        

 disable stream for requests         
STREAM::disable

}

 

when HTTP_RESPONSE { STREAM::enable

 

STREAM::expression {@../@/es/aw/Fleet/@} }

 

What am I doing wrong?

 

Thanks!

 

1 Reply

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    Try this:

    when HTTP_REQUEST {
         disable stream for requests
        STREAM::disable
    
         disable server side compression
        if { [HTTP::header exists "Accept-Encoding"] } {
            HTTP::header replace "Accept-Encoding" ""
        }
    
    }
    
    when HTTP_RESPONSE { 
         STREAM::enable
        if { [HTTP::header value Content-Type] contains "text" }{
            STREAM::expression {@\.\./@/es/aw/Fleet/@}
            STREAM::enable
        }
    }