Forum Discussion

topgman_162317's avatar
topgman_162317
Icon for Nimbostratus rankNimbostratus
Jan 24, 2016

irule to proxy traffic externally to another site

Hi Guys,

 

Hoping someone is able to help me out with an iRule that I'm having some problems trying to figure out how to construct, this is my first time on DC.

 

The irule is to proxy traffic externally to another site for several sites we have, for example :

 

we host :

 

and would like to proxy that traffic to the following sites hosted externally :

 

 

It's not a 301 redirect we require as we just wish to proxy the traffic on these sites for translation purposes.

 

Thanks in advance.

 

3 Replies

  • If all you're wanting to do is sending the request to another webserver, then you can achieve this with the node (or pool) commands, though you might need to rewrite the HTTP request to change the Host: line if the final webserver is not configured to respond to

    I'm thinking something like this

    when HTTP_REQUEST {

    switch -- [HTTP::uri] { "/testurl1" { HTTP::header replace "Host" "othersite1.org" pool othersite1_pool }

    "/testurl2" {
         HTTP::header replace "Host" "othersite2.org"
         pool othersite2_pool
       }
    
    }
    
    log local0. "Sending [HTTP::uri] to [LB::server]\r\n\r\n"
    

    }

    The virtual server has a pool named "default_pool", which is where anything not sent elsewhere by the irule will end up.

    If I request /something.txt, then I get the default_pool:

    Rule /Common/irule-to-proxy-traffic-externally-to-another-site : Sending /something.txt to /Common/default_pool 0
    

    And if I request /testurl1, it sends the request to a member of otherside1_pool:

    Rule /Common/irule-to-proxy-traffic-externally-to-another-site : Sending /testurl1 to /Common/othersite1_pool 0
    

    Does that help ?

  • Hi Ian,here

     

    Thanks very much for the reply, one if the problems I have is that the site that I am sending the traffic to is a host URL as opposed to an IP address, which is all I can seem to define in a node/pool. The host/URL where we wish to send the traffic to changes IP address on a semi regular basis so the potential solutions I have looked at seem to limit me to specifying an IP address only.