Sunday, 23 April 2017

Disable HTTP when SSL is enabled

I've currently installed tarang:Meteor-ssl-proxy as a separate node application. It enables me to access my meteor app via https:// However, I'm still able to access the meteor app via it's default localhost:3000 (or it's hostIP:3000 eg.: 1.2.3.4:3000)

How exactly do I disable direct access to the application via 3000?

I've tried this with force-ssl package, but it does nothing to force users from using https.

Here is my main.js of taranag-ssl:

~/experimental/Meteor-SSL-proxy$ cat 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);



via blueren

No comments:

Post a Comment