Forum Discussion
Anthony_Cheng_1
Nimbostratus
Aug 30, 2015irule to append for HTTP::header value Location
I am trying to append some parameters to a HTTP redirect; to my surprise when I tried to display the new value I see that the resulting value has a different string values attached to it. So it is appending at the end but displayed something different; I tried a few encoding but none seems to match the result.
when HTTP_RESPONSE {
if { [HTTP::is_redirect] && [string tolower [HTTP::header Location]]contains "example.com"}{
set [HTTP::header value Location] "[HTTP::header value Location]&stuff=1"
log local0. "New Location header value: [HTTP::header value Location] "
}
}
2 Replies
- VernonWells
Employee
The method for changing a header value is:
HTTP::replaceas in:
when HTTP_RESPONSE { if { [HTTP::is_redirect] && [string tolower [HTTP::header Location]] contains "example.com" } { HTTP::header replace Location "[HTTP::header value Location]&stuff=1" log local0. "New Location header value: [HTTP::header value Location] " } }Notice that the
operation is not placed in the substitution operators ([...]) because you require not return value from that operation.HTTP::header replace - Anthony_Cheng_1
Nimbostratus
Awesome that did it. :)
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