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 29, 2009An initial request of http://www.foo.com/bar?a=b should match this clause:
} 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"
and the query string argument should be appended after an ampersand. Can you add logging to each case and log the output of the URI update using this as an example:
when HTTP_REQUEST {
set query_args "p1=v1"
log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] request to [HTTP::host][HTTP::uri]. Appending $query_args."
if { [HTTP::uri] ends_with "?" } {
http://www.foo.com/bar? -> http://www.foo.com/bar?p1=v1
HTTP::uri "[HTTP::uri]$query_args"
log local0. "[IP::client_addr]:[TCP::client_port]: URI ends with ?"
} 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}"
log local0. "[IP::client_addr]:[TCP::client_port]: URI contains ?"
} else {
http://www.foo.com/bar -> http://www.foo.com/bar?p1=v1
HTTP::uri "[HTTP::uri]?$query_args"
log local0. "[IP::client_addr]:[TCP::client_port]: URI does not contain ?"
}
}
when HTTP_REQUEST priority 501 {
log local0. "[IP::client_addr]:[TCP::client_port]: (501) Updated URI: [HTTP::uri]"
}
Thanks,
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
