Exchange 2010 & F5

I have a iRule to block access of OWA from outside of our enviroment using the below code.

when HTTP_REQUEST {

HTTP::enable

if {[string tolower [HTTP::uri]] eq “/owa” } {

HTTP::respond 401

}

}

What we are seeing is repeated login screens. What we would like to see is a unauthorized or unavailable error message come up. What do I need to change to get a error message to pop up. F5s are running 10.2.3 OS.

Hi Mike,

A 401 is “The requested page needs a username and a password.” You could either return a page from the Load Balancer, redirect the traffic to a different location, or change your status code to a 403.

Hope this helps.

As Michael said, you could use a 403 for this to indicate the request will never be allowed. A 401 indicates the app wants the user to present credentials for the request.

You could check for a URI which starts with /owa instead of matching /owa exactly. And you shouldn’t need to call HTTP::enable unless you’re disabling the HTTP filter elsewhere with HTTP::disable:

when HTTP_REQUEST {
   if {[string tolower [HTTP::uri]] starts_with "/owa"}{
     HTTP::respond 403 content {Blocked!}
   }
}

Aaron