title: ssl version or cipher mismatch ExpressJS
body: <p>I have a problem with https in express and I don't really understand it:</p>
  
  <p><strong>This is from my last project (it works):</strong></p>
  
  <p>index.js:</p>
  
  <pre><code>var fs = require('fs');
  
  var http = require('http');
  var https = require('https');
  
  var privateKey  = fs.readFileSync(__dirname + '/cert/server.key', 'utf8');
  var certificate = fs.readFileSync(__dirname + '/cert/server.cert', 'utf8');
  
  var credentials = {key: privateKey, cert: certificate};
  var express = require('express');
  var app = express();
  
  var httpServer = http.createServer(app);
  var httpsServer = https.createServer(credentials, app);
  
  httpServer.listen(80);
  httpsServer.listen(443);
  
  //Force https
  app.use(function(req, res, next) {
    if(!req.secure) {
      return res.redirect(['https://', req.get('Host'), req.url].join(''));
    }
    next();
  });
  </code></pre>
  
  <p><strong>This is from my current project (doesn't work):</strong></p>
  
  <p>index.js:</p>
  
  <pre><code>var fs = require('fs');
  
   var configRaw = fs.readFileSync(__dirname + '/config.json', 'utf8', function(err, data) {
       if(err) {
           return abort('Can not read/ find' + __dirname + '/config.json'); //FIXME
       }
   });
  
   var config = JSON.parse(configRaw);
  
   console.log('  - loading webserver script..');
   var webServer = require(__dirname + '/lib/web_server.js');
  
   webServer.init(config.httpPort, config.httpsPort);
  </code></pre>
  
  <p>web_server.js:</p>
  
  <pre><code>var fs = require('fs');
  var http = require('http');
  var https = require('https');
  
  var privateKey = fs.readFileSync(__dirname + '/../ssl/server.key', 'utf8');
  var certificate = fs.readFileSync(__dirname + '/../ssl/server.cert', 'utf8');
  
  var credential = { key: privateKey, vert: certificate };
  var express = require('express');
  var app = express();
  
  var httpServer = http.createServer(app);
  var httpsServer = https.createServer(credential, app);
  
  this.init = function(httpPort, httpsPort){
     httpServer.listen(httpPort);
     httpsServer.listen(httpsPort);
  }
  
  app.use(function(req, res, next) {
  if(!req.secure) {
      return res.redirect(['https://', req.get('Host'), req.url].join(''));
  }
     next();  
  });
  </code></pre>
  
  <p>I am using the same certificate and key as before and never got an fs-error while reading a file or something.</p>
  
  <p>But when I go to localhost via the browser I get this message: <em>ERR_SSL_VERSION_OR_CIPHER_MISMATCH</em>.</p>
  
  <p>Please keep in mind that I am fairly new to Node.js - thank you very much in advance! ;)</p>