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("S ERVER_PORT ")=80 Then
Dim strSecureURL
strSecureURL = "https://"
strSecureURL = strSecureURL & Request.ServerVariables("S ERVER_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??
<%
If Request.ServerVariables("S
Dim strSecureURL
strSecureURL = "https://"
strSecureURL = strSecureURL & Request.ServerVariables("S
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??
Here's an even easier way:
<%@LANGUAGE="VBSCRIPT" %>
<%
sname = Request.ServerVariables("S ERVER_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("/someth ingelse/")
else
response.redirect("somewhe reelse.asp ")
end if
%>
<%@LANGUAGE="VBSCRIPT" %>
<%
sname = Request.ServerVariables("S
sname = ucase(sname)
if InStr(sname,"MAIL") <> 0 then
response.redirect "https://mail.mywork.com/exchange/"
elseif InStr(sname,"somethingelse
response.Redirect("/someth
else
response.redirect("somewhe
end if
%>
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
ASKER
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.
You need to make sure that whatever you call this script, that it is the first listed in the default documents list.
ASKER
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("S ERVER_NAME ")
sname = ucase(sname)
if InStr(sname,"MAIL") <> 0 then
response.redirect "https://mail.mywork.com/exchange/"
end if
%>
<%@LANGUAGE="VBSCRIPT" %>
<%
sname = Request.ServerVariables("S
sname = ucase(sname)
if InStr(sname,"MAIL") <> 0 then
response.redirect "https://mail.mywork.com/exchange/"
end if
%>
ASKER
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.
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("S ERVER_NAME ")
sname = ucase(sname)
if InStr(sname,"MAIL") <> 0 then
response.redirect "https://mail.mywork.com/exchange/"
end if
%>
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("S
sname = ucase(sname)
if InStr(sname,"MAIL") <> 0 then
response.redirect "https://mail.mywork.com/exchange/"
end if
%>
ASKER
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("S ERVER_PORT ")=80 Then
Dim strSecureURL
strSecureURL = "https://"
strSecureURL = strSecureURL & Request.ServerVariables("S ERVER_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
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("S
Dim strSecureURL
strSecureURL = "https://"
strSecureURL = strSecureURL & Request.ServerVariables("S
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>
What version of OWA are you using? Using SBS 2003?
you can email me at <email removed - PAQ_Man, CS Moderator>
ASKER
Server 2003 Enterprise Edition w/ Exchange 2003 SP1
** Yes I do have a tendancy to do that haha
** 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
Let me look at the configuration and then I will get back with you
ASKER
ok thanx
ASKER
help!! 8^)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
you can email me at <email removed, PAQ_Man> with any other questions
ASKER
thanx
ASKER
tried emailing you - no reply
Sorry - will reply today. My wife had a baby, and I have been playing catchup ever since
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.