For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Satarian_205136's avatar
Satarian_205136
Icon for Nimbostratus rankNimbostratus
Aug 21, 2015

iRule to URL rewrite

Hey All,

 

I've tried searching for a solution to this but nothing has come up. Probably because I am not sure the correct search query to put in. If this is answered already I apologize for the repeat.

 

I have an appliance that offers a web portal - lets call it portal.company.com. In this web portal there is a link to an external page: lets say www.google.com for argument sake. This is a simple HTML A HREF link.

 

I don't have the access / ability to edit the HTML code to point the link to my internal page work.company.com due to the way the appliance works.

 

The portal.company.com is using an F5 LTM virtual server. I'd like to know if there is an irule that can recognize that the user clicked this link and take the user to work.company.com instead of www.google.com

 

I hope the above makes sense. Please let me know if you need any clarification. I appreciate your help.

 

1 Reply

  • I guess the answer depends on what the portal is. Is this an APM portal or are you load balancing another portal product with an LTM?

    If the latter, once that URL gets to the client it's too late. So you're best option is to use an iRule to catch the responses from the portal and rewrite the www.google.com links. I'd probably use an empty STREAM profile and STREAM iRule. It might look something like this:

    when HTTP_REQUEST {
        HTTP::header remove Accept-Encoding
        STREAM::disable
    }
    when HTTP_RESPONSE {
        if { [HTTP::header Content-Type] contains "text" } {
            STREAM::expression {@www.google.com@www.company.com@}
            STREAM::enable
        }
    }