Forum Discussion
Russell_Backer_
Dec 22, 2011Nimbostratus
Stream Expressions
This is the IRule that I have when when HTTP_RESPONSE { if {[HTTP::header value Content-Type] contains "text"}{ STREAM::expression @} STREAM::ena...
hooleylist
Dec 27, 2011Cirrostratus
I think these are the matches Russell is trying to match/replace:
http://csweb -> https://csweb
http://www.quantum.com(?!http://www.quantum.com/ProductAwareTandC.aspx) -> https://www.quantum.com
http://maps.google.com -> https://maps.google.com
The second one is possibly causing the issue. I think you want this regex instead:
@http://www\.quantum\.com(?!/ProductAwareTandC\.aspx)@https://www.quantum.com@
If you want to do this without case sensitivity on the capitalized letters, you can use a character set:
@http://www\.quantum\.com(?!/[pP]roduct[aA]ware[tT]and[cC]\.aspx)@https://www.quantum.com@
If that regex doesn't work and you can't do this with negative lookaheads, you might try a more generic stream expression like @http://www\.quantum\.com[a-zA-Z0-9/?_-]*@@ and then check the matched string using STREAM::match in STREAM_MATCHED to determine whether to rewrite the protocol.
There's an example of this on the STREAM::expression wiki page:
http://devcentral.f5.com/wiki/iRules.STREAM__expression.ashx
This example shows how you can use in the event to check if the matched string meets some condition that can't easily be checked for using a single regex in .
Note that you should escape the periods in the "find" portion of the stream expression so they match on a literal period instead of any single character.
Aaron
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects