Forum Discussion

Banny_Lau_10257's avatar
Banny_Lau_10257
Icon for Nimbostratus rankNimbostratus
Jun 24, 2005

How to write irule to form the function of Virtual Host?

Hi !

 

 

 

Could irule form the function of Virtual Host like Apache? How to do it? Could you have simple example for it ? Thanks a lot !

 

 

 

 

Banny
  • This should get you started.

     

     

    when HTTP_REQUEST {

     

    set my_vhost [string tolower [HTTP::host]]

     

    if { $my_vhost == "www.shoe.com" } {

     

    pool shoepool

     

    } elseif { $my_vhost == "blog.shoe.com" } {

     

    pool blogpool

     

    } else {

     

    reject

     

    }

     

    }

     

     

    -Brian

     

     

    P.S. - Let us know what you are trying to do
  • This works good if there is no rewrite of the URL. How would you do that?

     

     

    ie:

     

     

    Apache Proxy

     

    ....

     

    ProxyPass / http://junk.domain.com/newsite

     

    ProxyPassReverse / http://junk.domain.com/newsite

     

     

    thanks for any help

     

     

    Tom.
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    I'm not sure I understand your question. What exactly are you trying to do with the iRule?

     

     

    Colin
  • I have a reverse Apache Proxy. The ProxyPass and ProxyPassReverse statements will either redirect or rewrite (not sure which) the incoming http request.

     

     

    I want my v9.x BigIP to do this with and IRULE but there is so much more granularity, I was curious if someone understood specifically the conversion specifics.

     

     

    For example: if the http comes in as http://junk.domain.com/test

     

    the apache proxy does a ProxyPass /test http://newdest.domain.com/otherdir

     

     

    What would be the equivalent from the IRULE? Such questions as:

     

    1) would I use [HTTP::uri] eq "/test"

     

    2) would I use HTTP::redirect http://newdest.domain.com/otherdir"

     

     

    Would the IRULE catch something like //junk.domian.com/test/anotherdir and rewrite it properly

     

     

    Is starts_with going to proxy "/testing" or just drop it?

     

    Should I use redirect or another directive?

     

     

    Does this make more sense?