Forum Discussion
How to match URI string with "#" character?
Hi Wallst32,
if you have conflicting names for /clientxyz*, then you have to use the more accurate condition of /clientxyz.
But keep in mind that the page may request other content right after (e.g. CSS, JScript, grafics, etc.). So you may need to forward some additional [HTTP::uri]'s to the [pool pool.1]...
The logging part is quite easy to handle. You can basically put every readable iRule command directly into the log statement..
when HTTP_REQUEST {
log -noname local0.debug "Client = [IP::client_addr] has requested the URI = [HTTP::uri]"
switch -glob -- [string tolower [HTTP::uri]] {
"/clientxyz" {
log -noname local0.debug "URI = [HTTP::uri] is getting forwarded to pool.1"
pool pool.1
}
default {
log -noname local0.debug "URI = [HTTP::uri] is getting forwarded to pool.2"
pool pool.2
}
}
}
Note: I've changed your code to ignore the case using a [string tolower] command and included an -- to explicitly mark the end of the -option section. Both changes would make the [switch] condition more robust...
Cheers, Kai
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