Forum Discussion

stupid48's avatar
stupid48
Icon for Altocumulus rankAltocumulus
Aug 12, 2015

Replace multiple strings with iRule?

Hi there,

 

I've got an occasion to replace a few strings in an HTTP_RESPONSE. I can't seem to figure out the syntax. I've got it replacing one using STREAM::expression but I'm not sure how to do two or three distinct texts.

 

Thanks for any advice...

 

3 Replies

  • I believe the

    STREAM::expression
    page provides the answer you're seeking:

    Specifically, you can space-delimit replacement pairs, as in:

    when HTTP_REQUEST {
        STREAM::disable
        HTTP::header remove "Accept-Encoding"
    }
    
    when HTTP_RESPONSE {
        STREAM::expression {/onething/anotherthing/ /secondthing/yetanother/}
        STREAM::enable
    }
    
  • Thanks. Sorry for wasting your time. I should have read the specs on STREAM::expression