Forum Discussion

GBurch's avatar
GBurch
Icon for Altostratus rankAltostratus
Nov 09, 2017

Add banner to HTML Pages with no control over HTTP code

I'm quite new to iRules, but I have a requirement to have the F5 add a banner message at the top of certain webpages. We aren't able to modify the source HTML of the pages though. Is this possible with either iRules or content profiles?

 

A bit more background: The F5 is acting as a forward proxy for Internet access. Our management have requested that we add a warning message to certain websites, but not block them entirely.

 

Thanks in advance

 

1 Reply

  • Yes, you can do this with a stream profile. You will need to identify where in the HTML code you want to insert the banner by defining what you have currently and what you want it to be.

     

    Below is a very basic example but might give you an idea on where to start.

     

    when HTTP_REQUEST {
        STREAM::disable
        set originalHTML ""
        set newHTML ""
    }
    
    when HTTP_RESPONSE {
        STREAM::expression "@$originalHTML@$newHTML@"
        STREAM::enable
    }