Forum Discussion

Priceless_20483's avatar
Priceless_20483
Icon for Nimbostratus rankNimbostratus
Jun 26, 2015

Pool selection based on URI

Hi, I'm running into an issue where i'm trying to select a pool based on the URI.

For example, when we go to http://site.com/app1, it goes to pool p_app1 and when we go to https://site.com/app2, it goes to pool p_app2. Here is the simple iRule i've created.

when HTTP_REQUEST {
switch [string tolower [HTTP::uri]] {
    "/app1" {
    pool p_app1
    HTTP::uri "/app1/"
    }
    "/app2" {
    pool p_app2
    HTTP::uri "/app2/"
    }
}
}

The problem I have is that it works fine for app1 but not for app2.

When I enter http://site.com/app2/, it gives a 404 not found. When I enter http://site.com/app2, it works and the app redirects to http://site.com/app2/login. When I try to log into the page, it waits a long time and finally gives a "This page can’t be displayed".

Both apps work perfectly when accessed internally no matter is there is a trailing slash or not.

The issue is that i'm not the one who developped the so called website and cannot find any documentation.

Do any of you guys have ever ran into something like this and can you help out?

Thanks !

1 Reply

  • the irule never match URI : /app2/login

    and to redirect /app1 to /app1/ do a redirect and not HTTP::uri replacement. (I commented this part)

    when HTTP_REQUEST {
        switch [string tolower [HTTP::uri]] {
            "/app1" {
                pool p_app1
                HTTP::uri "/app1/"
            }
            "/app1*" {
                pool p_app1
            }
            "/app2" {
                HTTP::redirect "/app2/"
                pool p_app2
                HTTP::uri "/app2/"
            }
            "/app2*" {
                pool p_app2
            }
        }
    }