Solved

Assistance on script

Posted on 2012-03-20
11
235 Views
Last Modified: 2012-05-13
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
0
Comment
Question by:mcse2007
  • 5
  • 4
  • 2
11 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 37741797
0
 
LVL 7

Author Comment

by:mcse2007
ID: 37741872
FYI - We are using Exchange 2007 with ISA 2004 SP3.  None of the above link applicable to this issue.
0
 
LVL 20

Accepted Solution

by:
Proculopsis earned 265 total points
ID: 37741907
if (document.location.protocol.toLowerCase() == "http:") {

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

}
0
 
LVL 7

Author Comment

by:mcse2007
ID: 37741914
thanks, but where do I insert that command into the existing script?
0
 
LVL 20

Expert Comment

by:Proculopsis
ID: 37741956
...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>
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 7

Author Comment

by:mcse2007
ID: 37741975
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 ------------
0
 
LVL 20

Expert Comment

by:Proculopsis
ID: 37741987
<html>
<head>
<script>
if (document.location.protocol.toLowerCase() == "http:") {

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

}
</script>
</head>
<body>
</body>
</html>
0
 
LVL 7

Author Comment

by:mcse2007
ID: 37742007
Ok, thanks.

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

Will this interfere with the existing script?
0
 
LVL 82

Expert Comment

by:leakim971
ID: 37742377
0
 
LVL 20

Expert Comment

by:Proculopsis
ID: 37742496
// 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 );
0
 
LVL 7

Author Comment

by:mcse2007
ID: 37770868
sorry i'm new to scripting....what should be the complete script?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now