domainnames can have leading or trailing special chars, duh
This commit is contained in:
parent
ba8cb66c4f
commit
1a9928af01
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue