Anderson__Eric_
Jun 29, 2007Nimbostratus
Trailing / in URI
We're new to the F5 devices and coming up to speed, painfully. One issue we're having is we have a public URL that is accessed by our users and customers.
The issue at hand is if anyone doesn't provide the traililng / on, for example, www.domain.com/purchase, they get rejected. However, if they type in www.domain.com/purchase/ everything works fine. The IP is being load-balanced. The individual IPs of the devices works just fine.
Have written the below iRule without much luck. The issue appears to be with the concat and the trailing / not getting appended to the URI. 1) Is there a setting within the device itself, we're using 6400 boxes or 2) can someone assist with the code below and provide insight? The issue appears to be with the line for concat. Thanks in advance!
when HTTP_REQUEST {
Get URI and convert to lowercase
set uri [string tolower [HTTP::uri]]
Log the lowercase URI
log local0. "lowercase uri: $uri"
Find out if there is a period in the URL stopping when it sees a ?
if { [findstr $uri "." 0 "?"] eq "." }{
do nothing -- not ending in a virutal directory, URI syntax is good.
log local0. "URI is not a directory"
}
elseif { not ($uri ends_with "/") }{
it's a virtual directory and the trailing / doesn't exist, let's add it.
log local0. "URI is a directory, concatenating / to \$uri: $uri"
set $uri [concat $uri/]
}
update the URI before sending the request to the pool
log local0. "updated \$uri: $uri"
HTTP::uri $uri
}