Forum Discussion
abeny_894
Nimbostratus
Dec 12, 2008HTTP::uri problem
Deal all,
I have got some problems on [HTTP::uri], for example:
_________________________________________________________
http://www.foo.com/development/ --> Pool 1
http://www.foo.com/marketing/ --> Pool 2
http://www.foo.com/support/ --> Pool 3
when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/development" } {
pool pool_development
} elseif {[HTTP::uri] starts_with "/marketing" } {
pool pool_marketing
} elseif {[HTTP::uri] starts_with "/support" } {
pool pool_support
}
else {
discard
}
}
______________________________________________________________
I found that the request is directly go to find the DEFAULT PAGE of http://www.foo.com/development/ rather than go to access the development pool
Is it the normal behaviour??
In fact I need to check the HTTP::uri in HTTP_REQUEST, if uri is match /development, it will go to development pool, however all members in development pool is using port8080.
Can give me some advise??
- hoolio
Cirrostratus
A switch statement might be easier to manage than a chain of if/elseif/else statements. You can add logging to see what's happening:when HTTP_REQUEST { Check the requested URI switch -glob [HTTP::uri] { "/development*" { log local0. "[IP::client_addr]:[TCP::local_port]: [HTTP::uri] matched /development" pool pool_development } "/marketing*" { log local0. "[IP::client_addr]:[TCP::local_port]: [HTTP::uri] matched /marketing" pool pool_marketing } "/support*" { log local0. "[IP::client_addr]:[TCP::local_port]: [HTTP::uri] matched /support" pool pool_support } default { log local0. "[IP::client_addr]:[TCP::local_port]: [HTTP::uri] hit default case" reject } } }
- abeny_894
Nimbostratus
Thanks Aaron, I try it and get back you soon - abeny_894
Nimbostratus
Hi Aaron, - abeny_894
Nimbostratus
Hi all, - hoolio
Cirrostratus
Hi Abeny, - abeny_894
Nimbostratus
Thanks Aaron. - hoolio
Cirrostratus
If you don't use -glob and add a wildcard to the /development case (like /development*), the case will only match when a client makes a request for exactly /development. If you want all requests which start with /development to go to the pool_development, you could use -glob and a wildcard:switch -glob [HTTP::uri] { "/development*" { pool pool_development } ...
- andy_22730
Nimbostratus
Hello: - hoolio
Cirrostratus
dillera, can you start a new post about this? I assume one way or another you're trying to send more than one redirect to the client either in the first rule or in another rule that's added to the same VIP. For suggestions on how to handle this try searching this forum for a relevant portion of the error message, like 'multiple redirects error'. If you get stuck, you could start a new post detailing the full iRule configuration for the particular VIP. - andy_22730
Nimbostratus
ok, will do.
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