Forum Discussion
if a URL ends with trailing slash "/"?
Hi , I have an iRule in which I need to check if the URL ends with "/", Looks like it's working for some URL's but not for all . Any help would be really apprecited. I am adding only a part of iRule.
so if the URL is http://abc.com/, it should go to default pool but it's going to other pool all the time. The condition is if a URL ends with "/" it should go to default pool:
eg: http://abc.com/ or http://abc.com/xyz/ or http://abc.com/xyz/abc/
Below is the iRule:
if {$retried == 0 && [HTTP::uri] ends_with "/"} { pool $default_pool {pool $lsds_pool } }
3 Replies
- Brad_Parker
Cirrus
Try just changing you conditional to include equals "/" as well.
if {$retried == 0 && ([HTTP::uri] ends_with "/" || [HTTP::uri] equals "/")} { pool $default_pool {pool $lsds_pool } } - Arie
Altostratus
Since
includes the query string you may want to useHTTP::uri
instead.HTTP::path - Kevin_Davies_40
Nacreous
if {$retried == 0 && [HTTP::path] ends_with "/"} { pool $default_pool {pool $lsds_pool } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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