Forum Discussion
dexthor_22173
Nimbostratus
May 16, 2011Skip 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 of the links on the Applications & Portals point to our partner sites (partner1.com; partner2.com).
My requirement:
When the user clicks on the partner link, currently F5 is rewriting it to proxy the external links.
My need is to skip/bypass rewriting of any URLs that do not belong to homedomain.com.
Also, I would like to define a "white list of trusted partners" and block all others (For example: to avoid phishing).
How can I achieve that using iRules ?
Many thanks
Dexthor.
- The_Bhattman
Nimbostratus
Hi Dexthor, - hoolio
Cirrostratus
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]]" } }
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