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.

Forum Discussion

smoraneng's avatar
smoraneng
Icon for Nimbostratus rankNimbostratus
Oct 28, 2019

Content Rewrite rule

I have been fighting with content rewrite rules and 90% of my site is being re-written, but there are a few perma links that are not, and as a result, I get mixed content warnings.

 

The basic content rewrite I lifted off of a devcentral article, see below. However, when the content contains:

"http:\/\/www.sitename.com\/sub\/sub\/\", it is bypassed and not translated. I have tried changing the stream expression from STREAM::expression {@http://@https://@} to STREAM::expression {@http:@https:@} and also STREAM::expression {@http:\/\/@https:\/\/@}, but it is still bypassed.

 

 

# Example which replaces http:// with https:// in response content

# Prevents server compression in responses

when HTTP_REQUEST {

 

  # Disable the stream filter for all requests

  STREAM::disable

 

  # LTM does not uncompress response content, so if the server has compression enabled

  # and it cannot be disabled on the server, we can prevent the server from 

  # sending a compressed response by removing the compression offerings from the client

  HTTP::header remove "Accept-Encoding"

}

when HTTP_RESPONSE {

 

  # Check if response type is text

  if {[HTTP::header value Content-Type] contains "text"}{

 

   # Replace http:// with https://

   STREAM::expression {@http://@https://@}

 

   # Enable the stream filter for this response only

   STREAM::enable

  }

}

1 Reply

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    You might want to use the STREAM_MATCHED event to trouble-shoot.