Forum Discussion

Miron_du_Plessi's avatar
Miron_du_Plessi
Icon for Nimbostratus rankNimbostratus
Oct 18, 2006

HTML Content Replace

Hi,

 

 

I realize that there have been a number of conversations started enquiring about replacing content in html. As someone new to the iRules structure im looking for a simple answer to the following question:-)

 

 

If for example I want to replace recuring item in the content

 

"Moonshine" with "ShoeShine Cloth" the following works okay.

 

Although I have to add in the quotation marks because of the space between ShoesShine and Cloth.

 

 

I am uncertain however as to how I would replace another occurrence eg: Sun with Moon ; http with https etc.

 

 

If I add a second STREAM::expression statement the first one is not implemented and only the second is.

 

 

The documentation and examples on the stream commands are unfortunately someone limited.

 

 

I presume the easy way would be to create two irules but this may not be the most processor friendly.

 

 

when HTTP_RESPONSE {

 

STREAM::enable

 

STREAM::expression "@Moonshine@ShoeShine Cloth@"

 

 

Regards

 

 

Miron du Plessis

1 Reply

  • douglohf posted a solution that should work, in this thread:

     

     

    Click here

     

     

     

    I have found something like this seems to work for replacing multiple items within a stream

     

     

    when HTTP_RESPONSE {

     

    STREAM::enable

     

    STREAM::expression @IE@Apache@@Windows@Linux@

     

    }

     

     

    This would replace IE with Apache and Windows with Linux

     

     

    9.2 is required as well as a stream profile defined within the Virtual Server. Just a blank stream profile works.