domainnames can have leading or trailing special chars, duh

This commit is contained in:
AJ ONeal 2015-02-22 10:09:18 +00:00
parent ba8cb66c4f
commit 1a9928af01
1 changed files with 8 additions and 8 deletions

View File

@ -324,11 +324,11 @@ 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
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\./, '');
domainname = domainname.replace(/.*\.?proxyable\./, '');
}
if (!secureContexts.dummy) {
@ -374,11 +374,11 @@ module.exports.create = function (securePort, certsPath, vhostsdir) {
// Get up and listening as absolutely quickly as possible
secureServer.on('request', function (req, res) {
if (/(^|\.)_proxyable\./.test(req.headers.host)) {
// device-id-12345678._proxyable.myapp.mydomain.com => myapp.mydomain.com
// _proxyable.myapp.mydomain.com => myapp.mydomain.com
if (/(^|\.)proxyable\./.test(req.headers.host)) {
// 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
req.headers.host = req.headers.host.replace(/.*\.?_proxyable\./, '');
req.headers.host = req.headers.host.replace(/.*\.?proxyable\./, '');
}
loadPromise().then(function (app) {