Forum Discussion
amebiz_142234
Nimbostratus
May 24, 2018override variables
example
when HTTP_REQUEST {
set var "foo"
if { [HTTP::uri start_with "/foobar"] } {
set var "bar"
}
}
when HTTP_RESPONSE {
log 1.1.1.1 "logging $var"
}
Hi guys, for all requests which they are not start_with /foobar will be logged with "foo".
But if there a Request matched with /foobar* then there will be also logged "foo" but that should be logged with "bar"
whats going wrong here? can i not overrides existing var's? or is there a special syntax for it?
2 Replies
- youssef1
Cumulonimbus
Hi,
of course you can override var... try this:
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] start_with "/foobar" } { set var "bar" } else { set var "foo" } } when HTTP_RESPONSE { log 1.1.1.1 "logging $var" }
- Stanislas_Piro2
Cumulonimbus
Hi,
the issue is this line:
if { [HTTP::uri start_with "/foobar"] } {
You must use
to get URI from HTTP request, then compare it with expected URI (move the close bracket from the end of the line to just after HTTP::uri)[HTTP::uri]
if { [HTTP::uri] start_with "/foobar" } {
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