Forum Discussion
Bob_10976
May 20, 2011Nimbostratus
Add a Trailing Slash to the URL
Hello all,
I'm needing to covert an ISAPI rule that adds a trailing slash to the end of a url to an iRule, however the tricky part here is i'll need to add in a few exceptions URLs.
For exampl...
Vova_200520
Altostratus
This is how I do it on v11 (protocol var is from another iRule):
set uri_base [URI::basename [HTTP::path]]
if {$uri_base equals ""} {
The URI::basename is /folder/
} elseif {$uri_base contains "."} {
The URI::basename is *.* file
} else {
HTTP::path "[HTTP::path]/"
HTTP::respond 301 "Location" "${protocol}://[HTTP::host][HTTP::path]"
return
}
Stanislas_Piro2
Jan 26, 2017Cumulonimbus
Hi Vova,
do not redirect to
${protocol}://[HTTP::host][HTTP::path]
but to [HTTP::path]
there is no need to send to the client the protocol and the server name of the next resource, the client will request with the same protocol and server name as the current one.
with this format, you optimize F5 performance and you prevent rewrite tasks on reverse proxy if there is one with different hostname.
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