Running IS and FCSW on a single machine
3112_100822_7.png

In another tip ( Redirecting to https in FirstClass 12) we describe how you can modify the login file of fcws to always redirect to https if you have certificates installed.  The tip assumes that you have FCWS and Internet Services running on separate computers or network cards and both FCWS and IS can listen on Port 80.  The tip assumes that if someone points to the FCWS login page on port 80, it will always be redirected to port 443.

However, what if your site is so small that you can run both Internet Services (IS) and FirstClass Web Services (FCWS) on the same machine.
 
One solution would be to run IS on a non standard port, but some sites will block that so it is always better to use the standard 80 and 443 ports for web services.

If this is the case, you must restrict FCWS to port 443 and not have it listen on port 80 as that is the port that IS will be listening on.

All you need to do is to get a certificate so that FCWS will run on standard SSL port 443 for the FCWS domain. In this case, you would NOT add the -e parameter to the startup string as I mentioned in my previous tip as the default now will be to only listen on port 443.

Then, instead of adding any javascript to the login file for FCWS as described in the previous tip, add it to your Home Page that is running for your IS domain.

Assuming that IS is running on www.mydomain.com on port 80 and fcws is running on fcws.mydomain.com on port 443, the most likely error that people will do is type http://fcws.mydomain.com and expect to get to the fcws login page.  Since fcws is running on port 443 and not listening on port 80 (IS, is listening on port 80), IS will display it's home page instead of the fcws login page.

The simple solution is to put your redirect in the IS home page.
If someone starts a page with http://fcws instead of https://fcws the following javascript will make the correction and redirect.

Just add this javascript to your default page for your IS web site (make it literal html if your IS home page is a FirstClass document)

<script type="text/javascript">
    var loc = window.location+'';
    if (loc.indexOf('http://fcws')==0){
         window.location.href = loc.replace('http://','https://');
    }
</script>