Forum Discussion

Jesse_Mauntel_4's avatar
Jesse_Mauntel_4
Icon for Nimbostratus rankNimbostratus
May 30, 2014

iRule to imitate rewrite with proxy [P] - revisited

Much like chemaf's question here: irule-to-imitate-rewrite-with-proxy-p, I have a need to imitate a feature of Apache's mod_rewrite module. However, the difference between chemaf's requirements and mine is that that my destination system is on the internet. For example:

RewriteRule ^/search/go$  http://externalsite.differentdomain.com/search  [P,L,QSA]

In this example, an external client connects to our public site and enters some text into our search box and clicks "go". The resulting GET is sent to our site, but then I need the F5 to fetch the data and provide it back to the client. Is this possible? I know that Apache's mod_rewrite does this via mod_proxy. Our web operations team has contracted with an external search results provider that want's us to use the mod_rewrite rule in the Apache servers, but I'd prefer to use the LTM if possible.

Any ideas? I've researched quite a bit and come up with nothing.

Thanks in advance,

Jesse

5 Replies

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account

    So you're looking to take the search terms passed into your site by a client, forward them off to a third party (In this example http://externalsite.differentdomain.com/search), fetch the results, and return those to the client?

     

    If that's correct then yes, this is possible via an iRule. Not necessarily entry level iRuling, but possible. Check out:

     

    https://devcentral.f5.com/wiki/iRules.sideband.ashx

     

    And an example:

     

    https://devcentral.f5.com/wiki/iRules.Sideband-connection-HTTP-example.ashx

     

  • Thanks for the quick reply, Colin. I thought about the Sideband option, but it started to feel like I was trying to fit a round peg into a square hole. We just decided to go with the mod_rewrite option in Apache.

     

    If the LTM could just allow the use of an fqdn:port pair when you define a pool member, it might have worked with a SNAT...

     

    Oh well. Thanks again.

     

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account

    You can certainly fire data off to a domain/port, if that's what you're looking for. The node command will get that done. :)

     

  • I'm not clear on what you mean. You mean you can assign something like www.google.com:80 as a pool member?

     

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account

    No, you can't set it up as a pool member, but if you're looking to send traffic to a given IP:port, you can absolutely do so with the node command:

     

    https://devcentral.f5.com/wiki/iRules.node.ashx

     

    You could also snat as necessary.