Forum Discussion
Randy_Johnson_1
Nimbostratus
Nov 29, 2006Question on (what should be) a simple redirect -
Hi, group-
I have a set of URLs I'd like to redirect. My rule looks like this -
when HTTP_REQUEST {
log local0. "Checking URI [HTTP::uri] from [IP::client_addr] for insecure calls to some server"
if { [string tolower [HTTP::uri]] equals "https://someserver.somedomain.net/fooserver/foo"} {
HTTP::redirect "https://redirect.somedomain.net"
log local0. "Request for [HTTP::uri] from [IP::client_addr] is being sent to the Admin site"
}
}
From my BigIP logs, it appears as though the request is checked, and logging occurs. However, redirection does not occur.
Am I missing something ?
Thanks !
7 Replies
- hoolio
Cirrostratus
It looks like you're mixing our interpretation of URI and URL. - Randy_Johnson_1
Nimbostratus
You're correct about the URI logged being /fooserver/foo. - Can you post the log output from your log statements? Your code looks correct so without knowing the exact contents of the HTTP::uri value it's hard to guess at what is going wrong.
- Randy_Johnson_1
Nimbostratus
The rule logs this string: - So is the second log statement not being reached? Since you only included the first log statement in your response I'm assuming the one in the enclosed if statement is not being reached. Is that a correct assumption. I have no clue on why a simple string comparison would not work.
when HTTP_REQUEST { log local0. "Checking URI '[HTTP::uri]' from [IP::client_addr] for insecure calls to some server" if { [string tolower [HTTP::uri]] equals "/fooserver/foo"} { log local0. "Request for '[HTTP::uri]' from [IP::client_addr] is being sent to the other site" HTTP::redirect "https://redirect.somedomain.net" } else { log local0. "Request for '[HTTP::uri]' from [IP::client_addr] is being allowed" } }
when HTTP_REQUEST { log local0. "Checking URI '[HTTP::uri]' from [IP::client_addr] for insecure calls to some server" switch [string tolower [HTTP::uri]] { "/fooserver/foo" { log local0. "Request for '[HTTP::uri]' from [IP::client_addr] is being sent to the other site" HTTP::redirect "https://redirect.somedomain.net" } default { log local0. "Request for '[HTTP::uri]' from [IP::client_addr] is being allowed" } } }
- Randy_Johnson_1
Nimbostratus
Thanks, Joe - The first sample works like a champ. - Whewww. I was about to be stumped on that one...
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