Forum Discussion
Moinul_Rony
Altostratus
May 15, 2014How to destroy and replace a URI query value ?
Hi,
I am trying to figure out how I can replace a URI query value.
For example for this we will select the URL based on the HTTP:host
Incoming URL pattern
https://host/URI?
http...
nitass
Employee
May 17, 2014what about this?
e.g.
config
root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm virtual bar
ltm virtual bar {
destination 172.28.24.10:80
ip-protocol tcp
mask 255.255.255.255
pool foo
profiles {
http { }
tcp { }
}
rules {
qux
}
source 0.0.0.0/0
source-address-translation {
type automap
}
vs-index 26
}
root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm pool foo
ltm pool foo {
members {
200.200.200.101:80 {
address 200.200.200.101
}
}
}
root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule qux
ltm rule qux {
when HTTP_REQUEST {
set q [URI::query [HTTP::uri] query]
if { $q ne "" } {
HTTP::uri [string map "$q ReplacedValue" [HTTP::uri]]
}
}
}
trace
[root@ve11a:Active:In Sync] config ssldump -Aed -nni 0.0 port 80
New TCP connection 1: 172.28.24.1(37391) <-> 172.28.24.10(80)
1400340463.6588 (0.0033) C>S
---------------------------------------------------------------
GET /URI?query=any_value&other=somethingelse 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.24.10
Accept: */*
---------------------------------------------------------------
New TCP connection 2: 200.200.200.14(37391) <-> 200.200.200.101(80)
1400340463.6622 (0.0016) C>S
---------------------------------------------------------------
GET /URI?query=ReplacedValue&other=somethingelse 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.24.10
Accept: */*
---------------------------------------------------------------
Moinul_Rony
Altostratus
May 19, 2014Thanks nitass,
I wanted the irule to look for query=A in the URI and replace query=A to query=B
Could I try using the condition
if { $q eq "query=A" } {
HTTP::uri [string map "$q Query=B" [HTTP::uri]]
}
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