title: nodejs + https + express - Error 324 (net::ERR_EMPTY_RESPONSE)
body: <p>I have a nodejs server structured like so:
  (app.js):</p>
  
  <pre><code>var fs = require('fs'),
      http = require('http'),
      https = require('https'),
      express = require('express'),
      connect = require('express/node_modules/connect'),
      app = module.exports = express();
  
  var ssl_options = {
      key: fs.readFileSync('/etc/nginx/ssl/server.key'),
      cert: fs.readFileSync('/etc/nginx/ssl/server.crt')
  };
  
  var server = https.createServer(ssl_options, app);
  
  // EXPRESS
  
  // app.set('view options', { layout: false });
  
  var auth_token = "asdfasfdasdfasdf";
  var express_session_id = "express.sid";
  
  app.configure(function () {
      app.use(express.cookieParser());
      app.use(express.session({secret: auth_token, key: express_session_id}));
  
      app.set("view options", {layout: false});
  });
  
  app.get('/', function (req, res) {
      console.log (req.headers);
      fs.readFile(__dirname + '/index.html', function(err, data){
          res.writeHead(200, {'Content-Type': 'text/html'});
          res.write(data, 'utf8');
          res.end();
      });
  });
  
  app.listen = function(port) {
      server.listen(port);
      console_log.log('info', "COTTONMOUTH server listening on port " + port);
  };
  </code></pre>
  
  <p>I have a cluster.js running the above app.js:</p>
  
  <pre><code>var cluster = require('cluster'),
      os = require('os'),
      workers = {};
  
  if (cluster.isMaster) {
  
      cluster.on('exit', function(worker, code, signal) {
          if (worker.suicide === false) {
              var exitCode = worker.process.exitCode;
              console.error('worker ' + worker.process.pid + ' died ('+exitCode+'). restarting...');
              cluster.fork();
          }
      });
  
      var n = process.env.PROC || os.cpus().length;
      for(var i = 0; i &lt; n; i++ ) {
          cluster.fork();
      }
  
      process.on('SIGTERM', function() {
          console.log('[MASTER] Going for shutdown...');
          for (var id in cluster.workers) { 
              console.log('\tkilling worker: ' + cluster.workers[id].process.pid);
              cluster.workers[id].destroy();
          }
          console.log("[MASTER] Here's looking at you, kid.");
      });
  
  } else {
      require('./app').listen(process.env.PORT || 3456);
  }
  </code></pre>
  
  <p>My problem is that the following setup works fine on my localhost virtual box environment (ubuntu virtual running on a mac host). I am able to access the nodejs server with dev.domain.com:3456.</p>
  
  <p>However, when I move this to my production rackspace server (same environment configs and setup), and try to access it by prod.domain.com:3456</p>
  
  <p>The browser hangs for a bit and returns <code>Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.</code></p>
  
  <p>I did some research and have found some leads but weren't too helpful.</p>
  
  <p>Any Ideas?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>when i lower the port down to 90, it seems to work which is interesting.
  I am going to leave it at port 90 for now but if someone has an answer to why this is.</p>
  
  <p>Thanks</p>