Link to home
Start Free TrialLog in
Avatar of Trihimbulus
Trihimbulus

asked on

Redirecting OWA to HTTPS

Ok, so we are running Exchange server 2003 and using OWA. By default the URL for OWA is (example) mail.mywork.com\exchange. I have already implemented the re-direct script that redirects and HTTP connection to HTTPS for this URL (via a script in the Inetpub\wwwroot\owaasp directory). Here's what I did:

<%
     If Request.ServerVariables("SERVER_PORT")=80 Then
         Dim strSecureURL
         strSecureURL = "https://"
         strSecureURL = strSecureURL & Request.ServerVariables("SERVER_NAME")
         strSecureURL = strSecureURL & "/exchange"
         Response.Redirect strSecureURL
     End If
   %>

A few weeks ago my employer wanted me to give people the option to just type in mail.mywork.com - to simplify the address (so I put a small script in the wwwroot called default.asp. Here's what I did:

<% Response.Redirect ("/exchange") %>

and thats it. So the problem now lies in the fact that they are redirected to HTTPS when they go to mail.mywork.com\exchange, but NOT when they hit mail.mywork.com. How do I re-direct the simpler URL to HTTPS as well??
Avatar of Sembee
Sembee
Flag of United Kingdom of Great Britain and Northern Ireland image

Make the change in IIS manager instead.

See this page on my web site: http://www.amset.info/exchange/default-web.asp
It includes a screenshot which makes it a little easier to understand.

Simon.
Avatar of jmeiss
jmeiss

Here's an even easier way:

<%@LANGUAGE="VBSCRIPT" %>
<%
sname = Request.ServerVariables("SERVER_NAME")
sname = ucase(sname)
      if InStr(sname,"MAIL") <> 0 then
            response.redirect "https://mail.mywork.com/exchange/"
      elseif InStr(sname,"somethingelse") <> 0 then
            response.Redirect("/somethingelse/")
      else
            response.redirect("somewhereelse.asp")
      end if
%>
Avatar of Trihimbulus

ASKER

So do I need to delete the re-direct from mail.mywork.com\exchange to mail.mywork.com - AND then add the following script above?
basically - the above script I sent does all of what you want...  It redirects all traffic sent to mail.mywork.com to https://mail.mywork.com/exchange...  It also puts in a check for another host.mywork.com as well as any other traffice to mywork.com

So how and where do I add this script to??
place it in your root IIS directory (commonly c:\inetpub\wwwroot) - name it something that is listed as a default document, i.e. default.asp.  You can assign that in the IIS preferences for the default web app under the Documents tab.

You need to make sure that whatever you call this script, that it is the first listed in the default documents list.
what do I replace the "somethingelse" with
if you want another prefix to redirect elsewhere (i.e. mywork.com/index.asp) you would put that there...  otherwise, use the following:

<%@LANGUAGE="VBSCRIPT" %>
<%
sname = Request.ServerVariables("SERVER_NAME")
sname = ucase(sname)
     if InStr(sname,"MAIL") <> 0 then
          response.redirect "https://mail.mywork.com/exchange/"
     end if
%>
Ok, it is sounding good. Now to just recap all of the requirements:

Need employees to be able to access OWA my the following ways:

mail.mywork.com - redirected to  https://mail.mywork.com
http://mail.mywork.com - redirected to  https://mail.mywork.com
https://mail.mywork.com - fine

mail.mywork.com\exchange - redirected to  https://mail.mywork.com\exchange
http://mail.mywork.com\exchange - redirected to  https://mail.mywork.com\exchange
https://mail.mywork.com\exchange - fine

So they need to hit it by mail.mywork.com  AND  mail.mywork.com\exchange
Both ways must BOTH be re-directed to HTTPS.

Just for stupidities sake (on my half hehe) - can you provide me withthe final script below to accomplish both requirements!

p.s. Thanks for being so patient - I just want to make the necessary changes to our configuration one time.
not sure why you want to redirect http://mail.mywork.com/ exchange to https://...  IIS already does that....  I believe...

anything to \exchange should automatically redirect to https:// since OWA requires https

test it out by typing in mail.mywork.com/exchange and see what happens....  if it doesn't, let me know and I will give you the changes for that....

Basically to do the first set of requirements in the root director:

<%@LANGUAGE="VBSCRIPT" %>
<%
sname = Request.ServerVariables("SERVER_NAME")
sname = ucase(sname)
     if InStr(sname,"MAIL") <> 0 then
          response.redirect "https://mail.mywork.com/exchange/"
     end if
%>
typed:

http://mail.mywork.com - and did not redirect to https

Now take in mind there are two seperate issues here. I already have a script i got off the MS site that redirect OWA to HTTPS for http://mail.mywork.com\exchange ONLY. I added the second script that allows the users to just type http://mail.mywork.com.
The only problem is that I need the http://mail.mywork.com to be redirected to HTTPS as well. I basically want there to be 2 ways to hit OWA and for both of them to be HTTPS.

Here is the original scripts for redirecting OWA to HTTPS for the http://mail.mywork.com\exchange:

<%
     If Request.ServerVariables("SERVER_PORT")=80 Then
         Dim strSecureURL
         strSecureURL = "https://"
         strSecureURL = strSecureURL & Request.ServerVariables("SERVER_NAME")
         strSecureURL = strSecureURL & "/exchange"
         Response.Redirect strSecureURL
     End If
   %>

and here is the script for allowing OWA to be hit by http://mail.mywork.com:


<% Response.Redirect ("/exchange") %>

*****************************

I am sure I am coming off as a pain in the arse- sorry
let me think about this and I will get back to you....  seems to me like you are making things harder than they should be....

What version of OWA are you using?  Using SBS 2003?  

you can email me at <email removed - PAQ_Man, CS Moderator>
Server 2003 Enterprise Edition w/ Exchange 2003 SP1

** Yes I do have a tendancy to do that haha
Ok SBS 2003 I believe automatically configures the Exchange IIS Virtual Directory to redirect to https://

Let me look at the configuration and then I will get back with you
ok thanx
help!! 8^)
ASKER CERTIFIED SOLUTION
Avatar of jmeiss
jmeiss

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
so with the above script, can I also hit OWA from typing in mail.mywork.com?
yes - you should be able to

you can email me at <email removed, PAQ_Man> with any other questions
thanx
tried emailing you - no reply
Sorry - will reply today.  My wife had a baby, and I have been playing catchup ever since