Forum Discussion

dradiant_306130's avatar
dradiant_306130
Icon for Nimbostratus rankNimbostratus
Jan 26, 2017

iRule for directing OWA/OA Traffic

Hey! Total beginner at iRules so hoping someone could point me in the right direction.

In summary what I want to do is the following:

1) If a Mac Outlook app comes in (using webmail.company.com/ews/exchange.asmx) > Send to a pool

2) If a request comes in directly to webmail.company.com > Redirect to a different URL

3) If any other request come in (ex. autodiscover.company.com) > Continue to default VIP behaviour

Since the domain listed is the same for 1+2 (difference is the URI) I want to make sure that if 1 is hit, 2 is not looked at and sent to the wrong place.

So far I have:

when HTTP_REQUEST {
  if {[string tolower [HTTP::uri]] equals "/ews/exchange.asmx"} {
            pool Exchange_2013_proxy_pool 
  } elseif {[string tolower [HTTP::host]] contains "webmail.company.com"} {
        HTTP::redirect "https://site.company.com" 
  }  
 }

Would this work to satisfy the first 2 conditions listed above? What happens when nothing is matched in this irule (ex. condition 3 where autodiscover.company.com is used)? Does it continue on to whatever the default behaviour is for my original VIP?

Any info or tips would be amazing!

  • Yes, if the pool isn't changed by the iRule the default pool will be used. You could also try something like this:

    when HTTP_REQUEST {
        if { [string tolower [HTTP::host]] equals "webmail.company.com" } {
            switch -glob [string tolower [HTTP::uri]] {
                "/ews/exchange.asmx" {
                    pool Exchange_2013_proxy_pool
                }
                default {
                    HTTP::redirect "https://site.company.com"
                }
            }  
        }
    }