Forum Discussion
Ranvir_Floura_7
Nimbostratus
Jan 02, 2008iRule and trailing slash issue
Folks,
Got a issue that is bugging me. Here is the iRule that I am working off and it works for the most part, but i have to put the trailing "/" for it to work. I need to have it working without the slash at the end.
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] starts_with "/dev3" } {
HTTP::uri [string range [HTTP::uri] 5 end]
pool dev3
}
}
The dev3 entry is mostly working as long as you remember to include a trailing "/" on the URL -- so https://www.aaa.bbb.com/dev3/ works where https://www.aaa.bbb.com/dev3 does not, it gives a message about a bad request.
Any ideas?
- hoolio
Cirrostratus
With that rule, if the URI was just /dev3, the URI sent to the web app would be null. That's not valid in HTTP. You could use this to check the URI:when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/dev3" } { Set the pool to dev3 for all requests starting with /dev3 pool dev3 Remove /dev3 from the URI set uri [string range [HTTP::uri] 5 end] Check if updated URI has a length if {$uri}{ Updated URI has a length, so set the request to the updated URI HTTP::uri $uri } else { Updated URI was empty, so set the URI to / HTTP::uri / } } }
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