Forum Discussion
dexthor_22173
May 16, 2011Nimbostratus
Skip rewriting of External URLs
I am new to F5 iRules, so please bear with me.
Situation:
0. Assume my domain is homedomain.com.
1. An Extranet of several existing applications and Portal pages.
2. Some...
hooleylist
May 17, 2011Cirrostratus
As Bhattman said, I think the last example is closest for doing validation of the links. If you provide more exact (but anonymized) examples of the response content you do and don't want to rewrite, we can give you more specific ideas on how to implement it. You could potentially have a whitelist of domains in a string datagroup and then use the class command to check the domains in the STREAM_MATCHED event:
From: http://devcentral.f5.com/Wiki/default.aspx/iRules/STREAM__expression
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]]"
}
}
http://devcentral.f5.com/Wiki/default.aspx/iRules/class
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