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 } }

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 } }

Since

HTTP::uri

includes the query string you may want to use

HTTP::path

instead.

if {$retried == 0 && [HTTP::path] ends_with "/"} { pool $default_pool {pool $lsds_pool } }