I have an IIS7/WinServer2008 configuration with a wildcard SSL certificate installed (*.mydomain.com). The web server holds several websites each configured to route via a host header off the same IP (call it IP1). Some of the sites are configured to use SSL and some are not.
So I have...
a.mydomain.com -> SSL
b.mydomain.com -> non-SSL
c.mydomain.com -> SSL
d.mydomain.com -> non-SSL
e.mydomain.com -> non-SSL
etc...
For the example sites A and C above (the SSL sites) I wanted standard HTTP URL's to redirect to HTTPS. So at the root of IIS (red arrow) I have configured the Error Pages settings by adding a custom Status Code of 403.4 (see below for the settings).
The contents of the redirectHttpToHttps.htm file are...
<html>
<head><title>Redirecting...</title></head>
<script language="JavaScript">
function redirectHttpToHttps()
{
var httpURL= window.location.hostname + window.location.pathname + window.location.search;
var httpsURL= "https://" + httpURL;
window.location = httpsURL;
}
redirectHttpToHttps();
</script>
<body>
</body>
</html>
Then for both the A and C sites I replaced the old bindings with an SSL binding (routed specifically to IP1) and set the SSL settings to "Require SSL".
So everything works great. Site A redirects http://a.mydomain.com to https://a.mydomain.com and similarly Site C does the same thing.
Now I have a non-wildcard SSL cert to introduce into the mix. This is for the site bound to aaa.customerdomain.com. So I added the cert to my IIS server, and changed the binding of the aaa.customerdomain.com site to use an SSL binding with the new cert and against a new IP2.
So now if I navigate to https://aaa.customerdomain.com, everything works great. However, I don't know how I can get http://aaa.customerdomain.com to redirect to the SSL version.
Can someone help me with the proper way to configure IIS so I can make all this work?