Forum Discussion
alvaro_martinez
Nimbostratus
Sep 21, 2006HTTP Redirect header localtion + uri
Hi,
I have the next reply from web server
HTTP/1.1 302 Moved Temporarily
Set-Cookie: BIGipServerACC-80=674006794.20480.0000; expires=Thu, 21-Sep-2006 11:05:27 GMT; path=/
...
hoolio
Cirrostratus
Sep 22, 2006Hello,
I think it's safer to look for a 302 response code and replace the Location header's host value if it's set to the value you want to replace, rather than generating the full response in the example you quoted.
when HTTP_RESPONSE {
if { [HTTP::status] contains "302" && [string tolower [HTTP::header Location]] contains "host_to_replace" }{
log local0. "Original Location: [HTTP::header Location]"
log local0. "New Location: [string map -nocase {"host_to_replace" "new_host"} [HTTP::header Location]]"
HTTP::header replace Location [string map -nocase {"host_to_replace" "new_host"} [HTTP::header Location]]
log local0. "Replaced Location with: [HTTP::header Location]"
}
}
Note: I left log statements in the rule to verify the replacement is being done as expected. The output is written to the /var/log/ltm log file. After you're done testing the rule, either comment out or delete the log lines.
I didn't test this completely, so repost here if you have any problems.
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
