fix proxying bug

This commit is contained in:
AJ ONeal 2015-02-21 18:05:26 +00:00
parent 669c69e5eb
commit ba8cb66c4f
1 changed files with 7 additions and 0 deletions

View File

@ -324,6 +324,13 @@ module.exports.create = function (securePort, certsPath, vhostsdir) {
function addSniWorkaroundCallback() {
//SNICallback is passed the domain name, see NodeJS docs on TLS
secureOpts.SNICallback = function (domainname, cb) {
if (/(^|\.)_proxyable\./.test(domainname)) {
// device-id-12345678._proxyable.myapp.mydomain.com => myapp.mydomain.com
// _proxyable.myapp.mydomain.com => myapp.mydomain.com
// TODO myapp.mydomain.com.proxyable.com => myapp.mydomain.com
domainname = domainname.replace(/.*\.?_proxyable\./, '');
}
if (!secureContexts.dummy) {
console.log('[log] Loading dummy certs');
secureContexts.dummy = createSecureContext(localDummyCerts);