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 [] string with the string to search and then replace the [] 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 :

  # 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"

  # 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

    if { [regsub -all "" [HTTP::payload] "" newdata] } {
        HTTP::payload replace 0 [HTTP::payload length] $newdata  
Published Mar 18, 2015
Version 1.0

Was this article helpful?

No CommentsBe the first to comment