Forum Discussion
jwitko
Nimbostratus
Jun 05, 2013Can I use a wildcard inside a HTTP::host contains conditional?
I have the following iRule:
when HTTP_REQUEST {
if {[HTTP::host] contains "example.domain.com" } {
switch -glob [HTTP::uri] {
"*example=e*" { pool examplee_http }
"*example=f*" { pool examplef_http }
"*example=g*" { pool exampleg_http }
default { pool examplee_http }
}
}
}
Is it possible to insert a wildcard into the 'contains' field so I can make this active on all versions of example*.domain.com? For instance is the following acceptable (modification in line 2):
when HTTP_REQUEST {
if {[HTTP::host] contains "example*.domain.com" } {
switch -glob [HTTP::uri] {
"*example=e*" { pool examplee_http }
"*example=f*" { pool examplef_http }
"*example=g*" { pool exampleg_http }
default { pool examplee_http }
}
}
}
Thanks!
-jwitko
1 Reply
- Kevin_Stewart
Employee
You cannot use wildcards with the contains operator, but you could use an equivalent string function:when HTTP_REQUEST { if { [string match "example*.domain.com" [string tolower [HTTP::host]]] } { switch -glob [string tolower [HTTP::uri]] { "/example=e*" { pool local-pool } "/example=f*" { pool local-pool } "/example=g*" { pool local-pool } default { pool local-pool } } } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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