https redirect requires /login.cmdx

My redirect works but only if I add an extension to my site.

For example: www.mysite.com/website-uat fails. However, www.mysite.com/website-uat/login.cmdx is successful. I don’t want to make my clients type in the extra /login.cmdx. How can I fix my irule to resolve that issue? See below the existing irule.

when HTTP_REQUEST {

switch [getfield [string tolower [HTTP::uri]] “/” 2] {

website { HTTP::redirect [HTTP::host] “:” 1][HTTP::uri] }

website-uat { HTTP::redirect [HTTP::host] “:” 1][HTTP::uri] }

website-stg { HTTP::redirect [HTTP::host] “:” 1][HTTP::uri] }

website-sales { HTTP::redirect [HTTP::host] “:” 1][HTTP::uri] }

}

}

Hi Chris,

How about adding logic like:

if {[HTTP::path] ends_with "/"}{
   HTTP::path "[HTTP::path]login.cmdx"
}

Else, couldn’t you update the web app to use a default object?

Aaron

Thanks Aaron. We will work with this. Unfortunately, I am a network admin and don’t know enough about the webapp to make the required change.

I am having diffculty combining the rules. The logic appears to be what is needed but I don’t understand the error.

when HTTP_REQUEST {

if {[HTTP::path] ends_with “/”{ HTTP::path “[HTTP::path]login.cmdx” }

}

switch [getfield [string tolower [HTTP::uri]] “/” 2] {

website { HTTP::redirect [HTTP::host] “:” 1][HTTP::uri] }

website-uat { HTTP::redirect [HTTP::host] “:” 1][HTTP::uri] }

website-sales { HTTP::redirect [HTTP::host] “:” 1][HTTP::uri] }

}

}

01070151:3: Rule error:

line 2: [parse error: PARSE syntax 51 syntax\ error\ in\ expression\ \“\[HTTP::path\]\ ends_with\ \”/\“\{\ HTTP::path\ \”\[HTTP::path\]login.cm…\":\ extra\ tokens\ at\ end\ of\ expression] [{[HTTP::path] ends_with “/”{ HTTP::path “[HTTP::path]login.cmdx” }

}]

line 3: [missing a script after “if”] []

I had a typo in my first reply:

if {[HTTP::path] ends_with “/”}{ HTTP::path “[HTTP::path]login.cmdx” }

Aaron

Thanks Aaron, That did it!