forked from coolaj86/goldilocks.js
use any available *localhost*.daplie.me certificate
This commit is contained in:
parent
f539feb37a
commit
658b095254
|
@ -141,13 +141,17 @@ function createServer(port, _delete_me_, content, opts) {
|
||||||
'localhost.daplie.me': null
|
'localhost.daplie.me': null
|
||||||
};
|
};
|
||||||
opts.httpsOptions.SNICallback = function (sni, cb ) {
|
opts.httpsOptions.SNICallback = function (sni, cb ) {
|
||||||
|
var tlsOptions;
|
||||||
console.log('[https] sni', sni);
|
console.log('[https] sni', sni);
|
||||||
|
|
||||||
// Static Certs
|
// Static Certs
|
||||||
if ('localhost.daplie.me' === sni) {
|
if (/.*localhost.*\.daplie\.me/.test(sni.toLowerCase())) {
|
||||||
// TODO implement
|
// TODO implement
|
||||||
if (!secureContexts[sni]) {
|
if (!secureContexts[sni]) {
|
||||||
secureContexts[sni] = tls.createSecureContext(require('localhost.daplie.me-certificates').merge({}));
|
tlsOptions = require('localhost.daplie.me-certificates').mergeTlsOptions(sni, {});
|
||||||
|
}
|
||||||
|
if (tlsOptions) {
|
||||||
|
secureContexts[sni] = tls.createSecureContext(tlsOptions);
|
||||||
}
|
}
|
||||||
cb(null, secureContexts[sni]);
|
cb(null, secureContexts[sni]);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue