uri based load balance

Hello

i’m using this iRule but i have problem.

The problem is when i request the url “www.domain.com/Touch” (it does not work) but if i add “/” at the end of the word it works (www.domain.com/Touch/)

i think web server is rewriting the url.The request change after the connect to the server www.domain.com/Touch/abc/index.jsp

i think if i add “/” after the word it will work, how can i do this or any suggestion

when HTTP_REQUEST {

set uri_info [HTTP::uri]

if { $uri_info starts_with “/Touch” or $uri_info starts_with “/cis” } {

pool pool_9081

} elseif { $uri_info starts_with “/Dispatch” } {

pool pool_9085

} else { HTTP::redirect “https://[HTTP::host][HTTP::uri]”

}

}

Hi Zafer,

The following example code simply examines the URI for a “/” and if it does not it performs a redirect with “/” at the end.

when HTTP_REQUEST { 
    if { [string tolower[HTTP::uri]] eq "/touch" } { 
       HTTP::redirect "http://[HTTP::host]/[HTTP::uri]/" 
    } 
 }

I hope this helps

Bhattman

it redirects request it is not load balance to the specific pool or member

zafer

Hi Zafer,

I think I miss understood. Here is another rework of the code

Here is an example

when HTTP_REQUEST { 
    set uri_info [strng tolower [HTTP::uri]] 
    switch -glob $uri_info { 
       "/touch" {  
                HTTP::redirect "https://[HTTP::host][HTTP::uri]/" 
                } 
       "/touch/*" - 
        /cis*" { 
                pool pool_9081 
               } 
       "/Dispatch*" 
               { 
                pool pool_9085 
               } 
    } 
 }

I hope this helps

Bhattman

Hi

in this implementation bigip will take webserver role from ibm server, load balance and redirect request to the specific pool

my problem ;

if client request type like this www.xx.com/touch (not works)

www.xx.com/touch/ (it works)

i worked with irule with these type solutions; append and rewrite url (append “/” and rewrite uri set uri $new_uri/) but i got another problems

i use append “/” but irule append “/” in to the all url

regarding rewrite url, “www.xxx.com/touch” rewrited to the “www.xxx.com/touch/” but after the login page bigip removes “/touch/” from url and we got some problems…

i changed your irule with my requirements. is that solve my problems, can be loop problem redirection and load balance to the pool

when HTTP_REQUEST {

set uri_info [string tolower [HTTP::uri]]

switch -glob $uri_info {

“/touch” {

HTTP::redirect “http://[HTTP::host][HTTP::uri]/” -----> add / to the url then

}

“/touch/*” {

pool pool_9081 -------------- load balance the specific pool

}

“/cis” {

HTTP::redirect “http://[HTTP::host][HTTP::uri]/”

}

“/cis/*” {

pool pool_9081

}

“/Dispatch*”

{

pool pool_9085

}

}

}