Forum Discussion

Godswill's avatar
Godswill
Icon for Nimbostratus rankNimbostratus
May 19, 2021

Pool selection using I-rule or policy

Help please with the follow irule or policy that can work for me.

 

I have one virtual server for the follow two website.

 

Client puts mcd-test.who.gov/acr -----> go to Pool pool 172.120.202.116 :7878

Client puts mcd-test.who.gov     -----> go to pool pool 172.120.202.116: 9999

 

whenever I applied the following irule to the virtual server, none of the website will load or work.

I have tried using policy and still get the same problem. Any help will be appreciated

 

when HTTP_REQUEST {

  switch [HTTP::host] {

    "mcp-test.who.gov/acr" {

      pool mcd-test.who.gov_7878_pool

    }

    "mcd-test.who.gov/acr" {

      pool mcd-test.who.gov_7878_pool

    }

  }

}

  • This is just reposting to correct major typo on my initial posting

    I am hoping that anyone can see any issue with the irule below and why it is not working

     

     

    Client puts mcd-test.who.gov/acr -----> go to Pool pool 172.120.202.116 :7878

    Client puts mcd-test.who.gov    -----> go to pool pool 172.120.202.116: 9999

     

    I created the follow i-rule

     

    when HTTP_REQUEST {

     switch [HTTP::host] {

       "mcp-test.who.gov" {

         pool mcd-test.who.gov_9999_pool

       }

       "mcd-test.who.gov/acr" {

         pool mcd-test.who.gov_7878_pool

       }

     }

    }

  • Hi,

     

    I think the problem is that the HTTP::host header only contains the domain name, not the URI. If you are looking for the URI (/acr), have a look at HTTP::uri instead.

     

    Also, you were quite rightly to try this in a Local Traffic Policy, as that will normally be the cleaner and faster way of deploying this. If you put a match statement in with the following logic, it should work for you;

     

    ...but with a different pool of course... ;)

     

    If it is still not working as expected, have a look at the Statistics of the policy as it will tell you which rule has been matched how many times. This should give you an indication of where the problem may lie.

     

    Hope this helps.