Forum Discussion
Michael_Yates
Sep 30, 2011Nimbostratus
Hi Misty,
One of the examples posted on the STREAM::expression Wiki page is probably what you are going to want to look into using:
when HTTP_REQUEST {
Disable the stream filter for all requests
STREAM::disable
}
when HTTP_RESPONSE {
Check if response type is text
if {[HTTP::header value Content-Type] contains "text" } {
Replace any http:// instance with https://, unless the original string is http://example.com
STREAM::expression {@http:(?!//example\.com)@https://@}
Enable the stream filter for this response only
STREAM::enable
}
}
The previous iRule will replace any http:// instance with https://, unless the original string is http://example.com.
The special characters are Regular Expressions.
() encapsulates the expression.
?! is a negative look ahead or don't replace this.
// is part of the lookup.
the \. is an escape character noting that the period is part of the literal compare.
So if you add in your exception you should be good to go.
There is a nice Regular Expression Cheat sheet here: http://www.addedbytes.com/download/regular-expressions-cheat-sheet-v2/pdf/