Forum Discussion
Valentine_96813
Nimbostratus
Sep 20, 2012iRule to disable stream profile
I have a VIP created for 123.abc.com that uses a blanket stream profile to rewrite all http to https and port 80 calls to 443.
/http:/https://:80/:443//HTTP:/https:/
What I need is to add an...
hoolio
Cirrostratus
Sep 21, 2012Hi Valentine,
You can customize the stream replacement with an iRule. There are a couple of examples on the STREAM::expression wiki page: https://devcentral.f5.com/wiki/iRules.stream__expression.ashx Replace any http:// instance with https://, unless the original string is http://example.com 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 } } 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"}{ Match an http://*example.com string and replace it with nothing yet STREAM::expression {&http://.*?example\.com&&} Enable the stream filter for this response only STREAM::enable } } when STREAM_MATCHED { Check if the matched string meets some condition that can't easily be checked for using a single regex in STREAM::expression if {[STREAM::match] starts_with "host1"}{ Replace http:// with https:// and do the replacement STREAM::replace "[string map {http:// https://} [STREAM::match]]" log local0. "[IP::client_addr]:[TCP::local_port]: matched: [STREAM::match], replaced with: [string map {http:// https://} [STREAM::match]]" } }
AaronRecent 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