Need help with quick redirect irule

I am trying to get the redirect for the outlook iapp to work a little better. Here is the redirect:

when HTTP_REQUEST {

if { ([HTTP::uri] == “/”) } {

HTTP::redirect https://[HTTP::host]/owa/

}

}

I need it to do this but ignore the rest of the uri. so if a user enters lets say = https://webmail.company.com/owa/cookie_example, i want it to redirect to https://webmail.company.com/owa/ (not including the cookie_example).

so basically i want it to look for “/” or “owa” and redirect it to only https://webmail.company.com/owa/. ignoring all other bits of uri.

so basically i want it to look for “/” or “owa” and redirect it to only https://webmail.company.com/owa/. ignoring all other bits of uri.

is the logic (redirect / or /owa/something to /owa/) indeed correct? i think it may cause an issue in accessing application. anyway, this is an example.

configuration

[root@ve11a:Active:In Sync] config  tmsh list ltm rule qux
ltm rule qux {
    when HTTP_REQUEST {
  switch -glob [string tolower [HTTP::path]] {
    "/owa/" {
       Do nothing
    }
    "/" -
    "/owa/*" {
      HTTP::redirect "https://[HTTP::host]/owa/"
    }
    default {
       Do nothing
    }
  }
}
}

 test

[root@ve11a:Active:In Sync] config  curl -I http://172.28.24.10/
HTTP/1.0 302 Found
Location: https://172.28.24.10/owa/
Server: BigIP
Connection: Keep-Alive
Content-Length: 0

[root@ve11a:Active:In Sync] config  curl -I http://172.28.24.10/owa/something
HTTP/1.0 302 Found
Location: https://172.28.24.10/owa/
Server: BigIP
Connection: Keep-Alive
Content-Length: 0

[root@ve11a:Active:In Sync] config  curl -I http://172.28.24.10/owa/
HTTP/1.1 404 Not Found
Date: Tue, 02 Jun 2015 04:12:26 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Sun, 09 Feb 2014 08:39:51 GMT
ETag: "41879c-59-2a9c23c0"
Accept-Ranges: bytes
Content-Length: 89
Content-Type: text/html; charset=UTF-8

Yah, this code breaks the ability to create a new email etc… I am just getting my users to clear their bookmarks etc… to hopefully fix the issue. But thank you for the help :frowning:

Here is some code that the F5 engineer gave me to test. Still don’t have time to test it but i thought the other people out there can have a look just in case they need it to: when RULE_INIT { set ::debug 0 } when CLIENT_ACCEPTED { if {[ info exists “first_loop”]}{ set first_loop 1 } else { set first_loop 0 } } when HTTP_REQUEST { if { $::debug } {log local0. “URI: [HTTP::uri] first_loop: $first_loop” } if { [HTTP::uri] == “/” } { if { $::debug } {log local0. “URI: [HTTP::uri] path_slash”} HTTP::redirect https://[HTTP::host]/owa/ } if { $first_loop == 0 } { if { $::debug } {log local0. “URI: [HTTP::uri] first_if: $first_loop” } set first_loop 1 if { [HTTP::uri] starts_with “/owa/” } { HTTP::uri /owa/ } } }