Skip to content

Commit d3a650f

Browse files
cwalvshellscape
authored andcommitted
include subjectAltName field in self-signed cert (#987)
fixes issue with reconnect on Chrome 58+
1 parent e519cf2 commit d3a650f

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

lib/Server.js

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,52 @@ function Server(compiler, options) {
386386
const pems = selfsigned.generate(attrs, {
387387
algorithm: 'sha256',
388388
days: 30,
389-
keySize: 2048
389+
keySize: 2048,
390+
extensions: [{
391+
name: 'basicConstraints',
392+
cA: true
393+
}, {
394+
name: 'keyUsage',
395+
keyCertSign: true,
396+
digitalSignature: true,
397+
nonRepudiation: true,
398+
keyEncipherment: true,
399+
dataEncipherment: true
400+
}, {
401+
name: 'subjectAltName',
402+
altNames: [
403+
{
404+
// type 2 is DNS
405+
type: 2,
406+
value: 'localhost'
407+
},
408+
{
409+
type: 2,
410+
value: 'localhost.localdomain'
411+
},
412+
{
413+
type: 2,
414+
value: 'lvh.me'
415+
},
416+
{
417+
type: 2,
418+
value: '*.lvh.me'
419+
},
420+
{
421+
type: 2,
422+
value: '[::1]'
423+
},
424+
{
425+
// type 7 is IP
426+
type: 7,
427+
ip: '127.0.0.1'
428+
},
429+
{
430+
type: 7,
431+
ip: 'fe80::1'
432+
}
433+
]
434+
}]
390435
});
391436

392437
fs.writeFileSync(certPath, pems.private + pems.cert, { encoding: 'utf-8' });

0 commit comments

Comments
 (0)