Forum Discussion

Tom_Kilday_9259's avatar
Tom_Kilday_9259
Icon for Nimbostratus rankNimbostratus
Jan 29, 2009

How to remove mixed content for https site

Looking for an Easy way. Remove the insecure javascript that points to the

 

watermark.gif

 

 

Script to remove

 

 

 

I tried this but it doesn't work

 

when HTTP_REQUEST {

 

set newuri "img/icon.offsite.gif"

 

set newhost "www.law.harvard.edu"

 

if { [HTTP::host] contains "www.google.com" and [HTTP::uri] contains "coop/cse/brand?form=cse-search-box&lang=en"}

 

{

 

HTTP::redirect "http://[HTTP::$newhost][HTTP::$newuri]"

 

}

 

 

}

 

 

thanks

 

-Tom

3 Replies

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    If you're looking to remove a string from within the HTTP payload itself, then your best bet is the stream profile. You won't be able to just perform a redirect as it doesn't look like you're dealing with host or URI information, really, but with the content being delivered by a server that is in turn pointing you to an insecure location to load some javascript.

     

     

    If you want to strip this out, check out the stream profile and what it can do. There are some great examples here on DevCentral, and it should be able to get you where you need to go in the most efficient manner.

     

     

    Colin
  • I am just trying to remove this one line

     

    ----

     

     

    -----

     

    I found this html scrubber but I am looking for help with the regular expression

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/HtmlCommentScrubber.html

     

     

  • If you want to replace a string within the request or response payload, you can use a blank stream profile and a STREAM::expression based iRule. Set the string to replace as your string with the regex metacharacters escaped. Make sure to check the STREAM::expression wiki page (Click here) for details.

     
     when HTTP_RESPONSE { 
      
         Disable the stream filter by default 
        STREAM::disable 
      
         Check if response type is text 
        if {[HTTP::header value Content-Type] contains "text"}{ 
      
            Replace google search form with nothing 
           STREAM::expression {@@@} 
      
            Enable the stream filter for this response only 
           STREAM::enable 
        } 
     } 
     

    Aaron