NodeJS Proxy -- cert is showing up for localhost.dapile.com

I am trying to set up a nodejs app using http-proxy while encrypting it with letsencrypt-express

The problem I am having is that the letsencrypt cert is showing up for localhost.dapile.com instead of the domain of my choosing.

var config = require('./config'),
    pkg = require('./package');
var moment = require('moment');
var http = require('http'),
    httpProxy = require('http-proxy');
var https = require('spdy');
var LEX = require('letsencrypt-express');

var lex = LEX.create({
  configDir: __dirname + '/letsencrypt/etc',
  approveRegistration: function( hostname, cb ) {
    cb(null, {
      domains: 'sub.domain.com',
      email: 'my@email.com',
      agreeTos: true
    });
  }
});

var proxy = httpProxy.createServer(config.proxyOptions);

http.createServer(function(req, res) {
  res.setHeader('Location', 'https://' + req.headers.host + req.url);
  res.statusCode = 302;
  res.end();
}).listen(80);

https.createServer(lex.httpsOptions, LEX.createAcmeResponder(lex, function(req, res) {
    proxy.web(req, res, { target: "http://other.domain.com" });
})).listen(443);

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.