Forum Discussion
Former Member
Feb 01, 2016check for trailing slash in /foo and /foo/bar
Hi,
I have a case where I want to add a trailing slash if someone hit /foo or /foo/bar. The rules below works but I wonder if it can be optimized:
when HTTP_REQUEST {
add trailing sla...
Former Member
Feb 01, 2016One thing which just came to my mind is that I need to exclude dot, for example index.html:
if {!([HTTP::uri] contains ".")} {
if {([string first "/" [HTTP::uri] 1] equals "-1") or ([string first "/" [string range [HTTP::uri] [string first "/" [HTTP::uri] 1] end] 1] equals "-1")} {
HTTP::redirect "${protocol}://[HTTP::host][HTTP::uri]/"
}
}
Which actually adds even one more check. My concern is if it will slow down the response (even a ms) from the balancer when doing a lot of sub checks.
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