Forum Discussion

Andrea_Knapp_28's avatar
Andrea_Knapp_28
Icon for Nimbostratus rankNimbostratus
Aug 01, 2006

Rule based on Directory.....

Hi All -

 

 

I am trying to create a rule in which a request is sent to a pool if it is in the directory. For example if http://abc.thisdomain.com comes in I want it to go to a maintenance pool, but if http://abc.thisdomain.com/language comes in I want to send it to a different pool. I am at a complete lost.

 

 

Thank you!

 

Andi

2 Replies

  • Hi Andi,

    Do you care what the host in the request is, or do you just want to route requests to a pool based on the URI (directory)?

    Here's an example if you want to check the host is abc.thisdomain.com:

    
    if (http_host equals "abc.thisdomain.com") {
       if (http_uri equals "/") {
          use pool pool1
       }
       else if (http_uri starts_with "/language") {
          use pool pool2
       }
    }
    else {
       use pool default_pool
    }

    Else, if you just want to make the load balancing decision based on the URI, you can use something like this:

    
    if (http_uri equals "/") {
       use pool pool1
    }
    else if (http_uri starts_with "/language") {
       use pool pool2
    }
    else {
       use pool default_pool
    }

    I wasn't able to get to a 4.x box to test this, so reply if you get any syntax errors or have more questions.

    Aaron
  • Hoolio -

     

     

    Thanks so much that worked. Now with a little twist. I am trying to apply this with SSL, that resides local to the webserver. This means I have a pool set up to go to the SSL. It does not seem to be working. So this is what I have:

     

     

    if (http_host == "abc.thisdomain.com") {

     

    if (http_uri == "/") {

     

    use pool MaintPageSSL

     

    }

     

    else if (http_uri starts_with "/language") {

     

    use pool ABCSSL

     

    }

     

    else {

     

    discard

     

    }

     

    }

     

    else {

     

    use pool ABCSSL

     

    }

     

     

     

    With the MaintPageSSL pointing to a server IPaddress:443 and ABCSSL with member IPAddress:443.

     

     

    I'm not quite sure what I am doing wrong here. If I just point the Virtual directly to the Pool then it works just fine, but the rule is just spinning and nothing happens, not even a certificate pop up.

     

     

    Thanks,

     

    Andi