Forum Discussion
iRule 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 irule that I can add to the VIP that excludes a link like below from that stream profile
http://server1:8001/page/index.html
I was thinking something like:
when
HTTP_RESPONSE
{
if
{[
HTTP::header
value Content-Type]
contains
"server1"
}
{
STREAM::disable}
}
}
- hoolioCirrostratus
Hi 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
AaronReplace 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]]" } }
- Valentine_96813Nimbostratus
So the examples are great but they are applying the stream via the irule. I have mine done with a profile. THe profile does HTTP and port 80 calls. these examples dont show that. I just need to be able to put in an exception to the profile. Are you telling me that I have to change from the profile to an iRule? And if so, can I put a port 80 call in the same iRule or do I need a seperate rule for that?
- What_Lies_Bene1CirrostratusYou should be able to use the profile and the iRule together without issue.
Recent Discussions
Related Content
* 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