Forum Discussion
Angelo
Nimbostratus
Jul 13, 2012I-rule not working
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"URI 1" {
pool pool1
}
"URI 2" {
pool pool2
}
"URI 3" {
pool pool3
}
8 Replies
- nitass
Employee
can you put some logging?
e.g.[root@ve10:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "URI 1" { pool pool1 } "URI 2" { pool pool2 } "URI 3" { pool pool3 } } } when HTTP_RESPONSE { log local0. "[IP::client_addr]:[TCP::client_port] -> [clientside {IP::local_addr}]:[clientside {TCP::local_port}] -> [IP::remote_addr]:[TCP::remote_port]" } } - Angelo
Nimbostratus
@nitass
Thanks for the reply
when trying to add i get a error
line 6: [command is not valid in the current scope] [when HTTP_RESPONSE
but another thing even the vendor irules that they installed doesn't seem to work. i can see on the F5 web-front that rules are executed without a error but it's just not working... - nathe
Cirrocumulus
Angelo
Think there's a rogue } at the end. Try this:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"URI 1" { pool pool1 }
"URI 2" { pool pool2 }
"URI 3" { pool pool3 }
}
}
when HTTP_RESPONSE {
log local0. "[IP::client_addr]:[TCP::client_port] -> [clientside {IP::local_addr}]:[clientside {TCP::local_port}] -> [IP::remote_addr]:[TCP::remote_port]"
}
As for the second part, as Nitass said, logging is a good starting point.
Hope this helps,
N - nitass
Employee
thanks nathan. 🙂
Angelo,
you may add more information in log.
e.g.[root@ve10:Active] config b virtual bar list virtual bar { snat automap pool foo destination 172.28.19.79:80 ip protocol 6 rules myrule profiles { http {} tcp {} } } [root@ve10:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { set uri [HTTP::uri] switch -glob [string tolower $uri] { "/uri1*" { pool pool1 } "/uri2*" { pool pool2 } "/uri3*" { pool pool3 } } } when HTTP_RESPONSE { log local0. "[IP::client_addr]:[TCP::client_port] -> [clientside {IP::local_addr}]:[clientside {TCP::local_port}] -> [IP::remote_addr]:[TCP::remote_port] | uri: $uri | pool: [LB::server pool]" } } [root@ve10:Active] config tail -f /var/log/ltm Jul 14 03:07:31 local/tmm info tmm[5111]: Rule myrule : 172.28.19.251:37297 -> 172.28.19.79:80 -> 200.200.200.101:80 | uri: /uri1 | pool: pool1 Jul 14 03:07:34 local/tmm info tmm[5111]: Rule myrule : 172.28.19.251:37298 -> 172.28.19.79:80 -> 200.200.200.101:80 | uri: /uri2 | pool: pool2 Jul 14 03:07:35 local/tmm info tmm[5111]: Rule myrule : 172.28.19.251:37299 -> 172.28.19.79:80 -> 200.200.200.101:80 | uri: /uri3 | pool: pool3 - Angelo
Nimbostratus
guys i got the rule woking the problem is now that all the traffic is only going to the first pool - Angelo
Nimbostratus
I'm getting this from the logs
Jul 17 21:11:04 tmm2 info tmm2[12177]: Rule /SOA/Irule_soa_dev : 10.200.201.14:53492 -> 10.211.184.100:443 -> 10.211.58.168:8111 | uri: /wccustom/ | pool: /SOA/pool1
Jul 17 21:11:04 tmm info tmm[12175]: Rule /SOA/Irule_soa_dev : 10.200.201.14:53494 -> 10.211.184.100:443 -> 10.211.58.178:8111 | uri: /favicon.ico | pool: /SOA/pool1
i don't know what this is /favicon.ico because it's not a uri defined.. - hoolio
Cirrostratus
favicon.ico is a request the browser makes automatically for display in the browser itself:
http://en.wikipedia.org/wiki/Favicon
Make sure to specify a default pool or use a OneConnect profile on the virtual server.when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/uri1*" { pool pool1 } "/uri2*" { pool pool2 } "/uri3*" { pool pool3 } default { pool my_default_pool} } }
Aaron - Angelo
Nimbostratus
thanks guys everything is working you guys are LEGENDS
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
