Forum Discussion
Dustin_Smith_29
Nimbostratus
Feb 09, 2007How to add a query string value to pass to servers in teh pool?
I would like to add a query string value to the incoming http request to distinguish on the server if it is coming in on an ssl virtual or not.
Example 1
From
https://ww...
hoolio
Cirrostratus
Sep 28, 2009stjbrown, the value for HTTP::uri and most other HTTP:: commands is cached within the same iRule event. You can see the updated value by adding a second HTTP_REQUEST event with a priority that triggers after the defautl priority of 500:
when HTTP_REQUEST {
set query_args "p1=v1"
log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] request to [HTTP::host][HTTP::uri]"
if { [HTTP::uri] ends_with "?" } {
http://www.foo.com/bar? -> http://www.foo.com/bar?p1=v1
HTTP::uri "[HTTP::uri]$query_args"
} elseif { [HTTP::uri] contains "?" } {
http://www.foo.com/bar?a=b -> http://www.foo.com/bar?a=b&p1=v1
HTTP::uri "[HTTP::uri]&$query_args"
} else {
http://www.foo.com/bar -> http://www.foo.com/bar?p1=v1
HTTP::uri "[HTTP::uri]?$query_args"
}
}
when HTTP_REQUEST priority 501 {
log local0. "[IP::client_addr]:[TCP::client_port]: (501) Updated URI: [HTTP::uri]"
}
Aaron
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
