Solved

Assistance on script

Posted on 2012-03-20
11
237 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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
 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

776 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