Disable HTTP when using SSL

Hello,

I’ve managed to create a self signed SSL certificate and am successfully using it along with tarang:meteor-ssl-proxy to enable ssl for my meteor app. (https://localhost or https://x.x.x.x)

However, when I try to access the app via it’s normal http (localhost:3000 or x.x.x.x:3000) I’m still able to access the app. I would like to force redirect this over HTTPS. I’ve tried force-ssl package, but it does not seem to force redirect localhost:3000 access.

Here is my Tarang:force-ssl-meteor-proxy main.js:


var PATH_TO_KEY = "/etc/ssl/server.key",
    PATH_TO_CERT = "/etc/ssl/server.crt";
    PATH_TO_CHAIN = "";

var fs = require('fs'),
    httpProxy = require('http-proxy');

var options = {
  ssl: {
    key: fs.readFileSync(PATH_TO_KEY, 'utf8'),
    cert: fs.readFileSync(PATH_TO_CERT, 'utf8'),
    //ca : fs.readFileSync(PATH_TO_CHAIN, 'utf8')
  },
  target : "http://localhost:3000",
  ws: true,
  xfwd: true
};

var server = httpProxy.createProxyServer(options).listen(443);

What am I missing? The only thing I require at this point in time is to disable / redirect http access.

Thanks.