Forum Discussion
Kiran_Kumar
Nimbostratus
Oct 18, 2013Append http query with the value of a variable set in the iRule
Hi Friends,
Could anyone share an iRule to append the http query with a variable set in the beginning of the iRule. I am supposedly setting a variable with name appid and i want to append the ht...
nitass
Employee
Oct 19, 2013just another example.
root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm virtual bar
ltm virtual bar {
destination 172.28.20.111:80
ip-protocol tcp
mask 255.255.255.255
pool foo
profiles {
http { }
tcp { }
}
rules {
myrule
}
source 0.0.0.0/0
source-address-translation {
type automap
}
vs-index 4
}
root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm rule myrule
ltm rule myrule {
when RULE_INIT {
set static::appid "abc123"
}
when HTTP_REQUEST {
if { [HTTP::query] ne "" } {
set append_uri "&appid=$static::appid"
} else {
set append_uri "?appid=$static::appid"
}
HTTP::uri "[HTTP::uri]$append_uri"
}
}
1
[root@ve11a:Active:Changes Pending] config ssldump -Aed -nni 0.0 port 80
New TCP connection 1: 172.28.20.17(44480) <-> 172.28.20.111(80)
1382149908.6585 (0.0010) C>S
---------------------------------------------------------------
GET /something 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.20.111
Accept: */*
---------------------------------------------------------------
New TCP connection 2: 200.200.200.14(44480) <-> 200.200.200.101(80)
1382149908.6606 (0.0020) C>S
---------------------------------------------------------------
GET /something?appid=abc123 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.20.111
Accept: */*
---------------------------------------------------------------
2
[root@ve11a:Active:Changes Pending] config ssldump -Aed -nni 0.0 port 80
New TCP connection 1: 172.28.20.17(44481) <-> 172.28.20.111(80)
1382149944.4161 (0.0011) C>S
---------------------------------------------------------------
GET /something?para1=value1 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.20.111
Accept: */*
---------------------------------------------------------------
New TCP connection 2: 200.200.200.14(44481) <-> 200.200.200.101(80)
1382149944.4180 (0.0017) C>S
---------------------------------------------------------------
GET /something?para1=value1&appid=abc123 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.20.111
Accept: */*
---------------------------------------------------------------
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