Forum Discussion
Chris_Olson
Nimbostratus
Aug 22, 2011https 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] }
}
}
5 Replies
- hoolio
Cirrostratus
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 - Chris_Olson
Nimbostratus
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.
- Chris_Olson
Nimbostratus
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"] [] - hoolio
Cirrostratus
I had a typo in my first reply:
if {[HTTP::path] ends_with "/"}{ HTTP::path "[HTTP::path]login.cmdx" }
Aaron - Chris_Olson
Nimbostratus
Thanks Aaron, That did it!
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects