Skip to content

Commit c12def3

Browse files
nekolabmichael-ciniawsky
authored andcommitted
fix(Server): set tls.DEFAULT_ECDH_CURVE to 'auto' (#1531)
1 parent e719959 commit c12def3

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/Server.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const fs = require('fs');
1313
const path = require('path');
1414

1515
const ip = require('ip');
16+
const tls = require('tls');
1617
const url = require('url');
1718
const http = require('http');
1819
const https = require('https');
@@ -40,6 +41,16 @@ const createCertificate = require('./utils/createCertificate');
4041
const validateOptions = require('schema-utils');
4142
const schema = require('./options.json');
4243

44+
// Workaround for node ^8.6.0, ^9.0.0
45+
// DEFAULT_ECDH_CURVE is default to prime256v1 in these version
46+
// breaking connection when certificate is not signed with prime256v1
47+
// change it to auto allows OpenSSL to select the curve automatically
48+
// See https://github.com/nodejs/node/issues/16196 for more infomation
49+
const version = parseFloat(process.version.slice(1));
50+
if (version >= 8.6 && version < 10) {
51+
tls.DEFAULT_ECDH_CURVE = 'auto';
52+
}
53+
4354
const STATS = {
4455
all: false,
4556
hash: true,
@@ -581,7 +592,7 @@ function Server (compiler, options = {}, _log) {
581592
// - https://github.com/nodejs/node/issues/21665
582593
// - https://github.com/webpack/webpack-dev-server/issues/1449
583594
// - https://github.com/expressjs/express/issues/3388
584-
if (+process.version.match(/^v(\d+)/)[1] >= 10) {
595+
if (version >= 10) {
585596
this.listeningApp = https.createServer(options.https, app);
586597
} else {
587598
this.listeningApp = spdy.createServer(options.https, app);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy