Forum Discussion
Redirect loses trailing "/"
I have some odd behavior on an HTTP redirect. Testing a site locally without adding a trailing "/" at the site name works fine. However, going through the F5 requires that the trailing "/" be entered manually for the site to come up. I cannot convince the business to force clients to add this to the URL manually. The activty appears that we are being redirected back to http and it fails. Seems like the rule will redirect to https but then will get redirected back to http if the "/" isn't present. Is it the pool redirect rule that is causing it?
Here are the rules:
____________________________________________________________
HTTPS redirect Rule (on the 80 VIP)____________________________________________________________
when HTTP_REQUEST {
switch [getfield [string tolower [HTTP::uri]] "/" 2] {
prod { HTTP::redirect [HTTP::host] ":" 1][HTTP::uri] }
prod-uat { HTTP::redirect [HTTP::host] ":" 1][HTTP::uri] }
prod-stg { HTTP::redirect [HTTP::host] ":" 1][HTTP::uri] }
prod-sales { HTTP::redirect [HTTP::host] ":" 1][HTTP::uri] }
}
}
___________________________________________________________________
Pool redirect Rule (on the 443 VIP)
____________________________________________________________________
when HTTP_REQUEST {
switch [getfield [string tolower [HTTP::uri]] "/" 2] {
prod { pool pool_2011.1_PROD }
prod-uat { pool pool_2011.1_UAT }
prod-sales { pool pool_2011.1_Sales }
prod-stg { pool pool_2011.1_Stage }
}
}
___________________________________________________________________
RESULTS
wget
--12:38:57-- http://www.website.com/prod-uat
=> `prod-uat'
Resolving
wget
--12:39:14-- http://www.website.com/prod-sales
=> `prod-sales'
Resolving
- The_Bhattman
Nimbostratus
Hi Chris, - Chris_Olson
Nimbostratus
Sure, if I knew enough about the syntax of the rule itself. My best guess is just before the number one as shown below? Could it be that simple? - The_Bhattman
Nimbostratus
Hi Chris, - L4L7_53191
Nimbostratus
You may also consider using redirect rewrite in the HTTP profile - see the section on trailing slash redirects:
Recent Discussions
Related Content
* 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