For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

SSL Termination

Problem this snippet solves:

Finds and replaces a link or specific text with another link or text, can be used for Sharepoint Portal SSL Termination.

You only need to replace the [http://www.website.com] string with the string to search and then replace the [https://www.website.com] with the string be replaced, this can be any text this does not have to be a website address.

This irule was created for Sharepoint Portal 2003 SSL Termination when displaying a HTTP website on an extranet accessed by HTTPS not all the links are converted to HTTPS.

How to use this snippet:

NOTE (deb 12/5/2007) This functionality is much more efficiently accomplished using the stream profile introduced in LTM v9.2.0

Code :

when HTTP_REQUEST {
  # Based on the Social Security and credit card scrubber
  # Don't allow data to be chunked
  if { [HTTP::version] eq "1.1" } {
      if { [HTTP::header is_keepalive] } {
         HTTP::header replace "Connection" "Keep-Alive"
      }
      HTTP::version "1.0"
   }
}

when HTTP_RESPONSE {
  # Only check responses that are a text content type 
  # (text/html, text/xml, text/plain, etc).
  if { [HTTP::header "Content-Type"] starts_with "text/" } {
    # Get the content length so we can request the data to be
    # processed in the HTTP_RESPONSE_DATA event.
    if { [HTTP::header exists "Content-Length"] } {
      set content_length [HTTP::header "Content-Length"]
    } else {
      set content_length 4294967295
    }
    if { $content_length > 0 } {
       HTTP::collect $content_length
    }
  }
}

when HTTP_RESPONSE_DATA {
    if { [regsub -all "http://www.website.com" [HTTP::payload] "https://www.website.com" newdata] } {
        HTTP::payload replace 0 [HTTP::payload length] $newdata  
    }
}
Published Mar 18, 2015
Version 1.0
No CommentsBe the first to comment