Solved

Assistance on script

Posted on 2012-03-20
11
233 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
Comment Utility
0
 
LVL 7

Author Comment

by:mcse2007
Comment Utility
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
Comment Utility
if (document.location.protocol.toLowerCase() == "http:") {

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

}
0
 
LVL 7

Author Comment

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

Expert Comment

by:Proculopsis
Comment Utility
...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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 7

Author Comment

by:mcse2007
Comment Utility
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
Comment Utility
<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
Comment Utility
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
Comment Utility
0
 
LVL 20

Expert Comment

by:Proculopsis
Comment Utility
// 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
Comment Utility
sorry i'm new to scripting....what should be the complete script?
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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 …
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
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…

763 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

7 Experts available now in Live!

Get 1:1 Help Now