diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 7f484491db..a5e876276c 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,17 +1,19 @@
- [ ] This is a **bugfix**
+- [ ] This is a **feature**
- [ ] This is a **code refactor**
- [ ] This is a **test update**
-- [ ] This is a **typo fix**
+- [ ] This is a **docs update**
- [ ] This is a **metadata update**
### For Bugs and Features; did you add new tests?
@@ -21,8 +23,9 @@
### Motivation / Use-Case
@@ -30,7 +33,7 @@
### Additional Info
diff --git a/.travis.yml b/.travis.yml
index 8410d5db1f..03d29e8404 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -18,7 +18,9 @@ jobs:
stage: Test (MacOS)
os: 'osx'
env: SCRIPT=test
- node_js: 'stable'
+ # Node 10 instead of 'stable' since Node 11 segfaults
+ # https://github.com/webpack/webpack-dev-server/pull/1588
+ node_js: 10
- <<: *osx
node_js: 'lts/*'
- <<: *osx
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3ab4da356d..21f5986b71 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,21 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+
+## [3.1.11](https://github.com/webpack/webpack-dev-server/compare/v3.1.10...v3.1.11) (2018-12-21)
+
+
+### Bug Fixes
+
+* **bin/options:** correct check for color support (`options.color`) ([#1555](https://github.com/webpack/webpack-dev-server/issues/1555)) ([55398b5](https://github.com/webpack/webpack-dev-server/commit/55398b5))
+* **package:** update `spdy` v3.4.1...4.0.0 (assertion error) ([#1491](https://github.com/webpack/webpack-dev-server/issues/1491)) ([#1563](https://github.com/webpack/webpack-dev-server/issues/1563)) ([7a3a257](https://github.com/webpack/webpack-dev-server/commit/7a3a257))
+* **Server:** correct `node` version checks ([#1543](https://github.com/webpack/webpack-dev-server/issues/1543)) ([927a2b3](https://github.com/webpack/webpack-dev-server/commit/927a2b3))
+* **Server:** mime type for wasm in contentBase directory ([#1575](https://github.com/webpack/webpack-dev-server/issues/1575)) ([#1580](https://github.com/webpack/webpack-dev-server/issues/1580)) ([fadae5d](https://github.com/webpack/webpack-dev-server/commit/fadae5d))
+* add url for compatibility with webpack@5 ([#1598](https://github.com/webpack/webpack-dev-server/issues/1598)) ([#1599](https://github.com/webpack/webpack-dev-server/issues/1599)) ([68dd49a](https://github.com/webpack/webpack-dev-server/commit/68dd49a))
+* check origin header for websocket connection ([#1603](https://github.com/webpack/webpack-dev-server/issues/1603)) ([b3217ca](https://github.com/webpack/webpack-dev-server/commit/b3217ca))
+
+
+
## [3.1.10](https://github.com/webpack/webpack-dev-server/compare/v3.1.9...v3.1.10) (2018-10-23)
diff --git a/bin/options.js b/bin/options.js
index d4352933cb..03e4d9fd74 100644
--- a/bin/options.js
+++ b/bin/options.js
@@ -57,7 +57,9 @@ const options = {
type: 'boolean',
alias: 'colors',
default: function supportsColor() {
- return require('supports-color');
+ // Use `require('supports-color').stdout` for supports-color >= 5.0.0.
+ // See https://github.com/webpack/webpack-dev-server/pull/1555.
+ return require('supports-color').stdout;
},
group: DISPLAY_GROUP,
describe: 'Enables/Disables colors on the console'
diff --git a/lib/Server.js b/lib/Server.js
index 065dc08bee..e1b2034acd 100644
--- a/lib/Server.js
+++ b/lib/Server.js
@@ -20,6 +20,8 @@ const https = require('https');
const spdy = require('spdy');
const sockjs = require('sockjs');
+const semver = require('semver');
+
const killable = require('killable');
const del = require('del');
@@ -46,8 +48,7 @@ const schema = require('./options.json');
// breaking connection when certificate is not signed with prime256v1
// change it to auto allows OpenSSL to select the curve automatically
// See https://github.com/nodejs/node/issues/16196 for more infomation
-const version = parseFloat(process.version.slice(1));
-if (version >= 8.6 && version < 10) {
+if (semver.satisfies(process.version, '8.6.0 - 9')) {
tls.DEFAULT_ECDH_CURVE = 'auto';
}
@@ -131,6 +132,10 @@ function Server (compiler, options = {}, _log) {
// eslint-disable-next-line
const app = this.app = new express();
+ // ref: https://github.com/webpack/webpack-dev-server/issues/1575
+ // remove this when send@^0.16.3
+ express.static.mime.types.wasm = 'application/wasm';
+
app.all('*', (req, res, next) => {
if (this.checkHost(req.headers)) {
return next();
@@ -592,7 +597,7 @@ function Server (compiler, options = {}, _log) {
// - https://github.com/nodejs/node/issues/21665
// - https://github.com/webpack/webpack-dev-server/issues/1449
// - https://github.com/expressjs/express/issues/3388
- if (version >= 10) {
+ if (semver.gte(process.version, '10.0.0')) {
this.listeningApp = https.createServer(options.https, app);
} else {
this.listeningApp = spdy.createServer(options.https, app);
@@ -625,14 +630,16 @@ Server.prototype.setContentHeaders = function (req, res, next) {
next();
};
-Server.prototype.checkHost = function (headers) {
+Server.prototype.checkHost = function (headers, headerToCheck) {
// allow user to opt-out this security check, at own risk
if (this.disableHostCheck) {
return true;
}
+
+ if (!headerToCheck) headerToCheck = 'host';
// get the Host header and extract hostname
// we don't care about port not matching
- const hostHeader = headers.host;
+ const hostHeader = headers[headerToCheck];
if (!hostHeader) {
return false;
@@ -720,8 +727,8 @@ Server.prototype.listen = function (port, hostname, fn) {
return;
}
- if (!this.checkHost(connection.headers)) {
- this.sockWrite([ connection ], 'error', 'Invalid Host header');
+ if (!this.checkHost(connection.headers) || !this.checkHost(connection.headers, 'origin')) {
+ this.sockWrite([ connection ], 'error', 'Invalid Host/Origin header');
connection.close();
diff --git a/package-lock.json b/package-lock.json
index 57aaae5d90..b1d71632a9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "webpack-dev-server",
- "version": "3.1.10",
+ "version": "3.1.11",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -3129,9 +3129,9 @@
}
},
"detect-node": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.0.3.tgz",
- "integrity": "sha1-ogM8CcyOFY03dI+951B4Mr1s4Sc="
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.0.4.tgz",
+ "integrity": "sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw=="
},
"diff": {
"version": "3.5.0",
@@ -5171,9 +5171,9 @@
"dev": true
},
"handle-thing": {
- "version": "1.2.5",
- "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-1.2.5.tgz",
- "integrity": "sha1-/Xqtcmvxpf0W38KbL3pmAdJxOcQ="
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.0.tgz",
+ "integrity": "sha512-d4sze1JNC454Wdo2fkuyzCr6aHcbL6PGGuFAz0Li/NcOm1tCHGnWDRmJP85dh9IhQErTc2svWFEX5xHIOo//kQ=="
},
"handlebars": {
"version": "4.0.11",
@@ -9851,8 +9851,7 @@
"querystring": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz",
- "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=",
- "dev": true
+ "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA="
},
"querystring-es3": {
"version": "0.2.1",
@@ -10393,9 +10392,9 @@
}
},
"semver": {
- "version": "5.5.1",
- "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz",
- "integrity": "sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw=="
+ "version": "5.6.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz",
+ "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg=="
},
"send": {
"version": "0.16.2",
@@ -10844,48 +10843,66 @@
"dev": true
},
"spdy": {
- "version": "3.4.7",
- "resolved": "https://registry.npmjs.org/spdy/-/spdy-3.4.7.tgz",
- "integrity": "sha1-Qv9B7OXMD5mjpsKKq7c/XDsDrLw=",
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.0.tgz",
+ "integrity": "sha512-ot0oEGT/PGUpzf/6uk4AWLqkq+irlqHXkrdbk51oWONh3bxQmBuljxPNl66zlRRcIJStWq0QkLUCPOPjgjvU0Q==",
"requires": {
- "debug": "^2.6.8",
- "handle-thing": "^1.2.5",
+ "debug": "^4.1.0",
+ "handle-thing": "^2.0.0",
"http-deceiver": "^1.2.7",
- "safe-buffer": "^5.0.1",
"select-hose": "^2.0.0",
- "spdy-transport": "^2.0.18"
+ "spdy-transport": "^3.0.0"
},
"dependencies": {
"debug": {
- "version": "2.6.9",
- "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
- "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz",
+ "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==",
"requires": {
- "ms": "2.0.0"
+ "ms": "^2.1.1"
}
+ },
+ "ms": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
+ "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
}
}
},
"spdy-transport": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-2.1.0.tgz",
- "integrity": "sha512-bpUeGpZcmZ692rrTiqf9/2EUakI6/kXX1Rpe0ib/DyOzbiexVfXkw6GnvI9hVGvIwVaUhkaBojjCZwLNRGQg1g==",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-3.0.0.tgz",
+ "integrity": "sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==",
"requires": {
- "debug": "^2.6.8",
- "detect-node": "^2.0.3",
+ "debug": "^4.1.0",
+ "detect-node": "^2.0.4",
"hpack.js": "^2.1.6",
- "obuf": "^1.1.1",
- "readable-stream": "^2.2.9",
- "safe-buffer": "^5.0.1",
- "wbuf": "^1.7.2"
+ "obuf": "^1.1.2",
+ "readable-stream": "^3.0.6",
+ "wbuf": "^1.7.3"
},
"dependencies": {
"debug": {
- "version": "2.6.9",
- "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
- "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz",
+ "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==",
"requires": {
- "ms": "2.0.0"
+ "ms": "^2.1.1"
+ }
+ },
+ "ms": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
+ "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
+ },
+ "readable-stream": {
+ "version": "3.0.6",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.0.6.tgz",
+ "integrity": "sha512-9E1oLoOWfhSXHGv6QlwXJim7uNzd9EVlWK+21tCU9Ju/kR0/p2AZYPz4qSchgO8PlLIH4FpZYfzwS+rEksZjIg==",
+ "requires": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
}
}
}
@@ -11688,7 +11705,6 @@
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz",
"integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=",
- "dev": true,
"requires": {
"punycode": "1.3.2",
"querystring": "0.2.0"
@@ -11697,8 +11713,7 @@
"punycode": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz",
- "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=",
- "dev": true
+ "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0="
}
}
},
diff --git a/package.json b/package.json
index 47452e1c31..fec38287d7 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "webpack-dev-server",
- "version": "3.1.10",
+ "version": "3.1.11",
"description": "Serves a webpack app. Updates the browser on changes.",
"bin": "bin/webpack-dev-server.js",
"main": "lib/Server.js",
@@ -44,12 +44,14 @@
"portfinder": "^1.0.9",
"schema-utils": "^1.0.0",
"selfsigned": "^1.9.1",
+ "semver": "^5.6.0",
"serve-index": "^1.7.2",
"sockjs": "0.3.19",
"sockjs-client": "1.3.0",
- "spdy": "^3.4.1",
+ "spdy": "^4.0.0",
"strip-ansi": "^3.0.0",
"supports-color": "^5.1.0",
+ "url": "^0.11.0",
"webpack-dev-middleware": "3.4.0",
"webpack-log": "^2.0.0",
"yargs": "12.0.2"
diff --git a/test/ContentBase.test.js b/test/ContentBase.test.js
index c2d105f50e..bcd98a7acd 100644
--- a/test/ContentBase.test.js
+++ b/test/ContentBase.test.js
@@ -121,4 +121,18 @@ describe('ContentBase', () => {
.expect(404, done);
});
});
+
+ describe('Content type', () => {
+ before((done) => {
+ server = helper.start(config, {
+ contentBase: [contentBasePublic]
+ }, done);
+ req = request(server.app);
+ });
+
+ it('Request foo.wasm', (done) => {
+ req.get('/foo.wasm')
+ .expect('Content-Type', 'application/wasm', done);
+ });
+ });
});
diff --git a/test/fixtures/contentbase-config/public/foo.wasm b/test/fixtures/contentbase-config/public/foo.wasm
new file mode 100644
index 0000000000..e69de29bb2