Forum Discussion

spirito_86848's avatar
spirito_86848
Icon for Nimbostratus rankNimbostratus
Apr 08, 2009

Use iRules to simulate a reverse proxy (HTTP bidirectional redirect)

Hi all, I'm very new about F5 and iRules but I've a big issue to solve using them.

 

 

I need to use F5 like a reverse proxy. I've implemented a web portal that is accessible via F5 (that is used to balance loads).

 

 

Each user will access to portal through a URL containing a dedicated “virtual” identifier:

 

 

http:////htmlresource

 

(for example http://www.myservice.stefano.it/company1/login.html)

 

 

To avoid publishing of FQDN associate to single company on public DNS, it’s required to implement a reverse proxy mechanism, managing to load balancing level that converts external request under this rule:

 

 

http:////request -->

 

http://./request (for example http://www.company1.myservice.local/login.html)

 

 

and, at go back, converts answers from internal to external under this rule:

 

http://./response --> http:////response

 

 

I've tried to write iRule for Request flow:

 

 

when HTTP_REQUEST {

 

if { [HTTP::uri] equals "http:\\www.myservice.stefano.it\company1\login.html"} {

 

HTTP::redirect "http:\\www.company1.myservice.local\login.html"

 

}

 

}

 

 

Now, I need to solve this problems:

 

1) Write the Respond part of the iRules

 

2) Find a way to generalize the resourse path of the URL, in way to avoid to write a specific iRules for each page of my portal

 

 

Thaks a lot to all,

 

Stefano

 

 

  • Hi Stefano,

     

    Take a look a the following Devcentral Post. Click here

     

     

    I believe it closely resembles to what you want to do

     

     

    Hope this helps

     

     

    CB