I have a node js server on the local lan that loads 3 public sites based on req.hostname:
app.get('/*',function(req,res){
console.dir(req.hostname);
console.dir(req.path);
var hostPath = '';
var pagePath = '';
if (req.path === '/') { pagePath = '/index' } else { pagePath = req.path }
switch(req.hostname){
case 'dom-1.com':
case 'www.dom-1.com':
hostPath = 'pages/dom-1';
break;
case 'dom-2.com':
case 'www.dom-2.com':
hostPath = 'pages/dom-2';
break;
case 'dom-3.com':
case 'www.dom-3.com':
hostPath = 'pages/dom-3';
break;
}
res.render(hostPath + pagePath);
});
above this code I have the following with which I am trying to also serve (via port 443) my mail server on a the lan via proxy:
app.use('/mail/', proxy('https://192.168.0.87',{
https: true
}));
but I get when loading https://mail.email.com/mail in a browser from outside the local lan:
Error: unable to verify the first certificate
at TLSSocket.<anonymous> (_tls_wrap.js:1116:38)
at emitNone (events.js:106:13)
at TLSSocket.emit (events.js:208:7)
at TLSSocket._finishInit (_tls_wrap.js:643:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:473:38)
We have gone through the steps to verify the certs are all the same on this server and the mail server
We tried doing
require('https').globalAgent.options.ca = require('ssl-root-cas/latest').create();
but this just breaks things, saying https.createServer is not a function (down further in the code)
If anyone has some suggestions for us, that would be awesome!