Angelo
Jul 13, 2012Nimbostratus
I-rule not working
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"URI 1" {
pool pool1
}
"URI 2" {
pool pool2
}
"URI 3" {
pool pool3
}
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"URI 1" {
pool pool1
}
"URI 2" {
pool pool2
}
"URI 3" {
pool pool3
}
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]"
}
}
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...
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
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
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..
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