Forum Discussion
new pool in switch statement doesn't work
Hello guys, I've got no any previous experience with F5 and that why I need your support with the following.
This is existed and working irule script:
when HTTP_REQUEST {
switch -glob [HTTP::host] {
"xxx.xxx.net"
{
switch -glob [HTTP::uri] {
"/abc*"
{
pool POOL_abc
return
}
"/xyz*"
{
pool POOL_xyz
return
}
default
{
HTTP::respond 200 content [ifile get reserved_website]
return
}
}}
}}
I made new pool via GUI called foo and added new uri in the switch statement as below but it didn't work and there is no traffic is forwarded to foo pool. could you please help with the reason why this doesn't not work? Thank you!
when HTTP_REQUEST {
switch -glob [HTTP::host] {
"xxx.xxx.net"
{
switch -glob [HTTP::uri] {
"/abc*"
{
pool POOL_abc
return
}
"/xyz*"
{
pool POOL_xyz
return
}
"/foo*"
{
pool POOL_foo
return
}
default
{
HTTP::respond 200 content [ifile get reserved_website]
return
}
}}
}}
could you please fix your coding? makes it easier to understand, just write it as normal and then add four spaces for every line.
i would add some log lines like
log local0. "/foo hit"
before the pool POOLfoo to make sure that it is seen
then do something similar for the host section to make sure you are requesting the right host
log local0. "[HTTP::host] host hit"
and for the uri
log local0. "[HTTP::uri] uri hit"
all to determine you are doing the expected request. if you see nothing then you might be working on the wrong iRule or virtual server.
- ayman_Mosaad_25
Nimbostratus
I've fixed it. thanks for mentioning that.
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