Forum Discussion
Greg_Bishop_104
Nimbostratus
Mar 15, 2009Redirect based on lists
Hi there, I think what I am aiming for is redirection based on two lists. So I'm thinking something like:
set uri [string tolower [HTTP::uri]]
set originallist [list "john" "sue" "nancy"]
set newlist [list "john2" "sue4" "nancy7"]
if { $uri ... in originallist }
HTTP::redirect http://www.domain.com/sites/...matching value from newlist
e.g. john goes to john2, sue goes to sue4, etc.
I would rather figure out how to do this than:
if { $uri equals "john" } { HTTP::redirect http://www.domain.com/sites/john2 }
elseif { $uri equals "sue" } { HTTP::redirect http://www.domain.com/sites/sue4 }
because these lists are going to be several hundred values long.
I apologize, I'm no programmer and I know zilch about matching, switching, arrays, lists, etc. Any help would be greatly appreciated!
Thanks,
Greg
1 Reply
- hoolio
Cirrostratus
Can you use a browser plugin like HttpFox for Firefox or Fiddler for IE to see what's actually happening? Can you try testing a rule like this:when HTTP_REQUEST { log local0. "[IP::client_addr]:[TCP::local_port]: New [HTTP::method] to [HTTP::host][HTTP::uri]" if {[HTTP::path] eq "/"}{ log local0. "[IP::client_addr]:[TCP::local_port]: Redirecting to https://[HTTP::host]/abc/xyz/login.do" HTTP::redirect "https://[HTTP::host]/abc/xyz/login.do" } }
- Vishal_96707
Nimbostratus
Thanks Aaron for providing quick solution as usual. I will try this and let you know. Thanks again. - Vishal_96707
Nimbostratus
Thanks Aaron the solution worked. Here is one more issue surfaced. - hoolio
Cirrostratus
Does the application include the :9443 port reference in 30x redirects in the Location header value? Or in response content? For the Location header, you can use an iRule like this:
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