iRule URI matching issue

Hi

I’m trying to match first term but whatever I do it is not match

this iRule check the URI and sends the request to the appropriate pool


when HTTP_REQUEST {

        if { [string tolower [HTTP::uri]] starts_with "/lmsserver" } {
        pool PLMS_Pool
        event disable
        }

        if { [string tolower [HTTP::path]] starts_with "/oauth" } {
        pool PLMS_Pool
        }

        if { [string tolower [HTTP::path]] starts_with "/lms/sso" } {
        set [http::path "/lmsserver"]
        pool PLMS_Pool
        }

        if { [string tolower [HTTP::path]] starts_with "/lms/rest/ext/oauth2/token" } {
        set [http::path "/lmsserver"]
        pool PLMS_Pool
        }


        if { [string tolower [HTTP::path]] starts_with "/dtpcms" } {
        pool PLMS_Pool
        }

        if { [string tolower [HTTP::path]] starts_with "/httppush" } {
        pool Push_Pool
        }

        if { [string tolower [HTTP::path]] starts_with "/admin" } {
        pool PTEACH_Pool
        }

        if { [string tolower [HTTP::path]] starts_with "/lms" } {
        pool PTEACH_Pool
        }

        if { [string tolower [HTTP::path]] starts_with "/rsp" } {
        pool PTDWH_Pool
        }   

        if { [string tolower [HTTP::path]] starts_with "/dwh" } {
        pool PTDWH_Pool
        }   

        if { [HTTP::uri] equals "/" } {
        HTTP::redirect "http://[HTTP::host]/lms"
        pool PTEACH_Pool
    }

}

If I go to /lmsserver instead of mapping me to PLMS_Pool , it is mapping me to PTEACH_Pool

why is that ?

Hi,

Your problem is that you not set a oneconnect profile.

Please set a OneConnect profile (Default) in your vs then try again.

Keep in mind that oneconnect allow you to detach connection in server side. You can force the server-side detachment by applying both an HTTP profile and a OneConnect profile to the virtual server, or by using an iRule to explicitly detach the server-side connection after each HTTP request.

Regards

Please try the following iRule, using a switch statement can avoid a lot of repetition (it is also faster than using if). As suggested above a policy may be an alternative. I have added logging to try to determine which conditions are being matched, please test and share the logging outputs, masking any sensitive information if necessary

when HTTP_REQUEST {
    switch [string tolower [HTTP::path]] {
        "/lmsserver" -
        "/oauth" -
        "/dtpcms" {
            pool PLMS_Pool
            log local0. "Path is [HTTP::path] selecting pool PLMS_Pool"
        }
        "/lms/sso" -
        "/lms/rest/ext/oauth2/token" {
            pool PLMS_Pool
            HTTP::path "/lmsserver"
            log local0. "setting Path to [HTTP::path] selecting pool PLMS_Pool"
        }
        "/httppush" {
            pool Push_Pool
            log local0. "Path is [HTTP::path] selecting pool Push_Pool"
        }
        "/admin" -
        "/lms" {
            pool PTEACH_Pool
            log local0. "Path is [HTTP::path] selecting pool PTEACH_Pool"
        }
        "/rsp" -
        "/dwh" {
          pool PTDWH_Pool  
          log local0. "Path is [HTTP::path] selecting pool PTDWH_Pool"
        }
        "/" {
            HTTP::redirect "http://[HTTP::host]/lms"
            pool PTEACH_Pool
            log local0. "Path is [HTTP::path] selecting pool PTEACH_Pool and sending redirect to http://[HTTP::host]/lms"
        }
    }
}