Forum Discussion
lunitic_56137
Nimbostratus
Feb 14, 2013URI Query question
I have an environment that has 3 different uri conditions that contain a queries.
Scenario 1
If a uri query contains "foo", add "&bar" at the end, and send it to the foo_bar_pool
Scenario 2
If a uri query has "bar" already in it, send it to foo_bar_pool
Scenario 3
If the uri query has "USER-ID" in it send to user_pool.
So with that in mind, I put the following rule together:
when HTTP_REQUEST {
set uri_query [HTTP::query]
set bar_query "&bar"
log local0. [HTTP::uri]
if {$uri_query contains "bar"}{
log local0. "Found bar, [HTTP::query] Sending to foo_bar_pool "
pool foo_bar_pool
if {$uri_query contains "foo"} {
[URI::query [HTTP::query]$blogin_query]
pool foo_bar_pool
}
if {$uri_query containes "USER-ID"} {
pool user_pool
}
}
}
But I get nothing. What am I missing?
1 Reply
Sort By
- nitass
Employee
e.g.[root@ve10:Active] config b virtual bar list virtual bar { snat automap destination 172.28.19.252:80 ip protocol 6 rules myrule profiles { http {} tcp {} } } [root@ve10:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { if {[URI::query "?&[HTTP::query]" bar] ne ""} { pool foo_bar_pool } elseif {[URI::query "?&[HTTP::query]" foo] ne ""} { HTTP::uri "[HTTP::uri]&bar=1234" pool foo_bar_pool } elseif {[URI::query "?&[HTTP::query]" USER-ID] ne ""} { pool user_pool } else { do something } } } [root@ve10:Active] config b pool foo_bar_pool list pool foo_bar_pool { members 200.200.200.101:80 {} } [root@ve10:Active] config b pool user_pool list pool user_pool { members 200.200.200.111:80 {} } foo [root@ve10:Active] config ssldump -Aed -nni 0.0 port 80 New TCP connection 1: 172.28.19.251(50138) <-> 172.28.19.252(80) 1360889294.2045 (0.0009) C>S --------------------------------------------------------------- HEAD /something?foo=abcdef HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: 172.28.19.252 Accept: */* --------------------------------------------------------------- New TCP connection 2: 200.200.200.10(50138) <-> 200.200.200.101(80) 1360889294.2056 (0.0009) C>S --------------------------------------------------------------- HEAD /something?foo=abcdef&bar=1234 HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: 172.28.19.252 Accept: */* --------------------------------------------------------------- bar [root@ve10:Active] config ssldump -Aed -nni 0.0 port 80 New TCP connection 1: 172.28.19.251(50139) <-> 172.28.19.252(80) 1360889333.7185 (0.0010) C>S --------------------------------------------------------------- HEAD /something?bar=xyz&foo=abcdef HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: 172.28.19.252 Accept: */* --------------------------------------------------------------- New TCP connection 2: 200.200.200.10(50139) <-> 200.200.200.101(80) 1360889333.7196 (0.0009) C>S --------------------------------------------------------------- HEAD /something?bar=xyz&foo=abcdef HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: 172.28.19.252 Accept: */* --------------------------------------------------------------- USER-ID [root@ve10:Active] config ssldump -Aed -nni 0.0 port 80 New TCP connection 1: 172.28.19.251(50140) <-> 172.28.19.252(80) 1360889374.9256 (0.0011) C>S --------------------------------------------------------------- HEAD /something?USER-ID=1111 HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: 172.28.19.252 Accept: */* --------------------------------------------------------------- New TCP connection 2: 200.200.200.10(50140) <-> 200.200.200.111(80) 1360889374.9274 (0.0017) C>S --------------------------------------------------------------- HEAD /something?USER-ID=1111 HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: 172.28.19.252 Accept: */* ---------------------------------------------------------------
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