Forum Discussion
Stephen_Archer_
Jul 03, 2006Historic F5 Account
re-write HTTP Response code 302 to HTTPS
Hi, I hope someone can help.
I have adapted the following code from a previous post:
when HTTP_RESPONSE {
if { [HTTP::status] contains "302"} {
if { [HTTP::header locat...
Colin_Walker_12
Jul 05, 2006Historic F5 Account
Well, the first thing I would do is add a log statement to each step of the rule, to make sure that all the different sections are being evaluated as expected.
Something like:
when HTTP_RESPONSE {
if { [HTTP::status] contains "302"} {
log local0. "Status code captured : [HTTP::status]"
if { [HTTP::header location] contains "http://www.test.com/portal/" } {
log local0. "Location header matches : [HTTP::header location"
set newLoc [string map {http https} [HTTP::header location] ]
log local0. "New string location: $newLoc"
HTTP::header replace location "$newLoc"
}
}
}
This should show you what's happening in the rule and what's not. Also note that I modified the string map command to be much simpler. Since the URLs are the same, you only need to change the http / https portion.
Give this a shot and see if you can figure out what's happening / not happening. Let us know if you've got more questions.
HTH,
Colin
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