Forum Discussion

Pramod_Gopala_1's avatar
Pramod_Gopala_1
Icon for Nimbostratus rankNimbostratus
Sep 15, 2015

Single Virtual Server with Multiple Pools for different URL context

Hi All,

 

At our client site, we need to create a virtual server with multiple pools for different URL contexts. Below is the iRule written for the virtual server:

 

when HTTP_REQUEST {
if {[string tolower [HTTP::host]] starts_with "www.companyname.net"}
{
switch -glob [string tolower [HTTP::uri]] {     
        "/portal/*" { pool portal-poolname }
        "/ptstest/*" { pool ptstest-poolname }
        "/pooltest*" { pool pooltest-poolname }
        "/mob/*" { pool MOB-poolname }
            "/code*" { pool CODE-poolname }
        "/iplc*" { pool ipl-poolname }
        }
}

When I use the above iRule in the Virtual Server created we are unable to access. But, if I use choose individual pool without using the iRule pool members are accessible.

 

Please let me know is there any changes required in the iRule or do we need to check any other configurations and settings in the Virtual Server.

 

Thanks in Advance!

 

1 Reply

  • Hi,

     

    you should check the ltm-log if any error messages are thrown. And you should add some logging to the iRule to verify what's coming in and which path will be chosen (if any). Something like this:

     

    when HTTP_REQUEST {
        log local0. "Host: [HTTP::host], URI: [HTTP::uri]"
        if {[string tolower [HTTP::host]] starts_with "www.companyname.net"} {
            log local0. "Host starts_with www.companyname.net"
            switch -glob [string tolower [HTTP::uri]] {
                "/portal1/*" {
                    log local0. "Pool agentportal-poolname chosen"
                    pool agentportal-poolname
                }
                "/ptstest/*" {
                    log local0. "Pool ptstest-poolname chosen"
                    pool ptstest-poolname
                }
                "/pooltest*" {
                    log local0. "Pool pooltest-poolname chosen"
                    pool pooltest-poolname
                }
                "/mob/*" {
                    log local0. "Pool MOB-poolname chosen"
                    pool MOB-poolname
                }
                "/code*" {
                    log local0. "Pool CODE-poolname chosen"
                    pool CODE-poolname
                }
                "/iplc*" {
                    log local0. "Pool iplc-poolname chosen"
                    pool iplc-poolname
                }
                default {
                    log local0. "No Pool chosen"
                }
            }
        }
    }
    

    I also assume you have a HTTP profile assigned to your VS (otherwise you should get an error message when assigning the iRule to your VS) and in case it's a HTTPS-VS you also have a clientSSL-profile assigned.

     

    Ciao Stefan 🙂