Forum Discussion
anuj_2931
Nimbostratus
Jun 02, 2012Trying to write an irule which inspects url parameters to select the appropriate pool
Hi Guys,
I have a Virtual server which will get http requests like this http://mysite.com/login?id=xyz-1, http:://mysite.com/login?id=xyz-2.
I want the iRule to inspect the paramet...
nitass
Employee
Jun 02, 2012is this applicable?
[root@ve1024:Active] config b virtual bar list
virtual bar {
snat automap
destination 172.28.19.79:80
ip protocol 6
rules myrule
persist cookie
profiles {
http {}
tcp {}
}
}
[root@ve1024:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
if { [HTTP::query] ends_with "1" } {
pool foo1
} elseif { [HTTP::query] ends_with "2" } {
pool foo2
} else {
persist none
pool foo
}
}
when SERVER_CONNECTED {
log local0. "[IP::client_addr]:[TCP::client_port] -> [clientside {IP::local_addr}]:[clientside {TCP::local_port}] -> [IP::remote_addr]:[TCP::remote_port]"
}
}
[root@ve1024:Active] config b pool foo list
pool foo {
members 200.200.200.101:80 {}
}
[root@ve1024:Active] config b pool foo1 list
pool foo1 {
members 200.200.200.101:80 {}
}
[root@ve1024:Active] config b pool foo2 list
pool foo2 {
members 200.200.200.102:80 {}
}
[root@ve1024:Active] config curl -I http://172.28.19.79/?test=xyz1
HTTP/1.1 200 OK
Date: Sat, 02 Jun 2012 15:22:29 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Fri, 11 Nov 2011 14:48:14 GMT
ETag: "4183e4-3e-9c564780"
Accept-Ranges: bytes
Content-Length: 62
Content-Type: text/html; charset=UTF-8
Set-Cookie: BIGipServerfoo1=1707657416.20480.0000; path=/
/var/log/ltm
Jun 2 08:22:09 local/tmm info tmm[4793]: Rule myrule : 172.28.19.80:52027 -> 172.28.19.79:80 -> 200.200.200.101:80
[root@ve1024:Active] config curl -I http://172.28.19.79/?test=xyz2
HTTP/1.1 200 OK
Date: Sat, 02 Jun 2012 15:12:53 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Tue, 08 Nov 2011 12:26:29 GMT
ETag: "4183f1-30-47e02740"
Accept-Ranges: bytes
Content-Length: 48
Content-Type: text/html; charset=UTF-8
Set-Cookie: BIGipServerfoo2=1724434632.20480.0000; path=/
/var/log/ltm
Jun 2 08:22:36 local/tmm info tmm[4793]: Rule myrule : 172.28.19.80:57225 -> 172.28.19.79:80 -> 200.200.200.102:80
[root@ve1024:Active] config curl -I http://172.28.19.79/?test=xyz3
HTTP/1.1 200 OK
Date: Sat, 02 Jun 2012 15:23:17 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Fri, 11 Nov 2011 14:48:14 GMT
ETag: "4183e4-3e-9c564780"
Accept-Ranges: bytes
Content-Length: 62
Content-Type: text/html; charset=UTF-8
/var/log/ltm
Jun 2 08:22:57 local/tmm info tmm[4793]: Rule myrule : 172.28.19.80:57226 -> 172.28.19.79:80 -> 200.200.200.101:80
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