Forum Discussion
Louie_DeArce_11
Nimbostratus
Jul 02, 2013Need iRule to block outbound links from site
Hello all,
I am an intern tasked with an issue. We have a test environment for our e-commerce site and we want to remove all the outbound links associated with the site. For example, we don't w...
Kevin_Stewart
Employee
Jul 03, 2013You have to look at this more from an HTML/HTTP perspective. An embedded link could manifest in a few different forms. The simplest would be redirects and static page links. I've also seen some crazy apps where client side JavaScript generates the links.
A redirect will be a 30x type message from your site to the user's browser, causing the browser to follow that link. You can see the 30x redirect in the HTTP response headers and rewrite/discard it:
===================
when HTTP_RESPONSE {
if { ( [HTTP::is_redirect] ) and ( [string tolower [HTTP::header Location]] contains "facebook.com" ) } {
...
}
}
===================
A static link is presented in the HTML payload that the browser renders. Example:
Facebook
If the user clicks on that link, it'll navigate directly to it without going back through your VIP. So to prevent this from happening you must catch and replace the offending HTML content as it leaves the BIG-IP. The faster option is a STREAM profile, but getting the match/regex strings right can be challenging. The HTTP::collect and HTTP::payload commands can be more flexible, but present a potential CPU utilization issue as you try to parse all content on every response. I'd personally spend my time developing the STREAM profile idea.
The next question then is, where and how are the links presented (redirects, links in the payload, both?). It's important to understand this. Do you have samples that we can see?
** Hopefully your app isn't generating the links in the browser side JavaScript, as this is significantly more difficult to overcome. Not impossible usually, but more of a challenge.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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