Link to home
Start Free TrialLog in
Avatar of mcse2007
mcse2007Flag for Australia

asked on

Assistance on script

Hi,

I have been asked by my client to redirect HTTP to HTTPS behind ISA (firewall).

So, I did some digging in the ISA forum and found the attached script to redirect HTTP to HTTPS. But, I would like to refine it.

For instance, if a clueless user typed the below, he gets redirect to
HTTPS://webmail.domain.com.au/owa    (no matter how you tell the users to use HTTPS, they are so clueless that they keep typing HTTP).,  

Redirect    http://webmail.*        ===>        https://webmail.domain.com.au/owa

Appreciate if you can assist to modify the attached script?
redirect.txt
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Avatar of mcse2007

ASKER

FYI - We are using Exchange 2007 with ISA 2004 SP3.  None of the above link applicable to this issue.
ASKER CERTIFIED SOLUTION
Avatar of Proculopsis
Proculopsis

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
thanks, but where do I insert that command into the existing script?
Avatar of Proculopsis
Proculopsis

...as soon as you can in the head section...

<head>
<script>
if (document.location.protocol.toLowerCase() == "http:") {

    document.location.replace((document.location.toString().replace(/^(http)/, "$1s")));

}
</script>
</head>
Like this........??????


 ---------- 12211r.htm ------------
<head>
<script>
if (document.location.protocol.toLowerCase() == "http:") {

    document.location.replace((document.location.toString().replace(/^(http)/, "$1s")));

}
</script>
</head>


 <HTML>
 <body onLoad="SecurePort();">
 </body>
 <script language="javascript">
 /*

 */
 function SecurePort()
 {
 // Initialize variables
 strProtocol = location.protocol
 strSecureURL = "https://";
 strServerName = location.host;
 //alert(location.protocol);
 // Check for http protocol to make sure it's a public request and secure it
 if(strProtocol == "http:")
 {
 strSecureURL = strSecureURL + strServerName;
 //alert("redirecting to:" + strSecureURL);
 document.location = strSecureURL;
 }
 }

 </script>
 </html>
 ---------- end 12211r.htm ------------
<html>
<head>
<script>
if (document.location.protocol.toLowerCase() == "http:") {

    document.location.replace((document.location.toString().replace(/^(http)/, "$1s")));

}
</script>
</head>
<body>
</body>
</html>
Ok, thanks.

We have another script that redirects .com.au to .com

Will this interfere with the existing script?
// you can do both together:

var uri = document.location.toString().replace(/^(http):/, "$1s:");
uri = uri.replace( /\.au\//, "/" )

if ( uri != document.location ) document.location.replace( uri );
sorry i'm new to scripting....what should be the complete script?