Skip to content

Commit

Permalink
include subjectAltName field in self-signed cert
Browse files Browse the repository at this point in the history
fixes issue with reconnect on Chrome 58+
  • Loading branch information
cwalv authored and Charles Arnold committed Sep 12, 2017
1 parent f166177 commit 54084da
Showing 1 changed file with 46 additions and 1 deletion.
47 changes: 46 additions & 1 deletion lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,52 @@ function Server(compiler, options) {
const pems = selfsigned.generate(attrs, {
algorithm: 'sha256',
days: 30,
keySize: 2048
keySize: 2048,
extensions: [{
name: 'basicConstraints',
cA: true
}, {
name: 'keyUsage',
keyCertSign: true,
digitalSignature: true,
nonRepudiation: true,
keyEncipherment: true,
dataEncipherment: true
}, {
name: 'subjectAltName',
altNames: [
{
// type 2 is DNS
type: 2,
value: 'localhost'
},
{
type: 2,
value: 'localhost.localdomain'
},
{
type: 2,
value: 'lvh.me'
},
{
type: 2,
value: '*.lvh.me'
},
{
type: 2,
value: '[::1]'
},
{
// type 7 is IP
type: 7,
ip: '127.0.0.1'
},
{
type: 7,
ip: 'fe80::1'
}
]
}]
});

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

0 comments on commit 54084da

Please sign in to comment.