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...
hooleylist
May 23, 2011Cirrostratus
You can create a string datagroup in the GUI with your URI tokens that shouldn't have the trailing slash added to. Which LTM version are you running? For 10.x, you'd want to use the class command to look up the requested URI in the datagroup. For 9.x you could use matchclass.
http://devcentral.f5.com/wiki/default.aspx/iRules/class
Note, you must be on 10.2.1HF1 or higher to use HTTP::path like this:
CR142756 - Using HTTP::path to set the path truncates the query string in v10.0 - v10.2.1 (fixed in 10.2.1HF1)
when HTTP_REQUEST {
Check if the HTTP path is not in the datagroup and does not already end with a /
if { not ([class match [HTTP::path] equals slashblacklist]) and not ([HTTP::path] ends_with "/")} {
Append
HTTP::path "[HTTP::path]/"
}
}
Aaron
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