Forum Discussion
Nathan_Bultman_
Oct 24, 2009Historic F5 Account
Header replacement assistance
Problem:
When a request comes in, if it has the header MyHeader (regardless of value), we need to change the Referer header value, from http://domain.com/path/object to https://domain...
hoolio
Cirrostratus
Oct 25, 2009Hi Nathan,
I think you should find a TCL error in /var/log/ltm from trying to execute the value of https://domain.com[HTTP::uri] with the square braces that is wrapped in.
Can you clarify what you actually want to do in the Referer header update. Do you just want to replace http:// with https:// and preserve the rest of the header value? Your current rule is replacing the original Referer value with https:// and the current URI. The current URI wouldn't typically be the same as the Referer URI.
Maybe try this:
when HTTP_REQUEST {
log local0. "[IP::client_addr]:[TCP::client_port]: New [HTTP::method] request to [HTTP::host][HTTP::uri]\
with Referer [HTTP::header Referer]"
if {[HTTP::header exists "MyHeader"]} {
log local0. "[IP::client_addr]:[TCP::client_port]: Updating Referer to\
[string map -nocase {http:// https://} [HTTP::header Referer]"
HTTP::header replace Referer "[string map -nocase {http:// https://} [HTTP::header Referer]"
}
}
when HTTP_REQUEST priority 501 {
log local0. "[IP::client_addr]:[TCP::client_port] (501): Current Referer [HTTP::header Referer]"
}
Aaron
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