Solved

Assistance on script

Posted on 2012-03-20
11
239 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
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 embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

809 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