From 1dfd4fbe0c3ac8d25aa381231cb92b3ed805c8da Mon Sep 17 00:00:00 2001 From: "Masahiro Miyashiro (3846masa)" <3846masahiro@gmail.com> Date: Mon, 24 Dec 2018 18:56:56 +0900 Subject: [PATCH 1/2] fix: add workaround for Origin header in sockjs (#1608) --- lib/Server.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/Server.js b/lib/Server.js index 50e8d553ff..d76af59010 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -43,6 +43,22 @@ const createCertificate = require('./utils/createCertificate'); const validateOptions = require('schema-utils'); const schema = require('./options.json'); +// Workaround for sockjs@~0.3.19 +// sockjs will remove Origin header, however Origin header is required for checking host. +// See https://github.com/webpack/webpack-dev-server/issues/1604 for more information +{ + // eslint-disable-next-line global-require + const SockjsSession = require('sockjs/lib/transport').Session; + const decorateConnection = SockjsSession.prototype.decorateConnection; + SockjsSession.prototype.decorateConnection = function(req) { + decorateConnection.call(this, req); + const connection = this.connection; + if (connection.headers && !('origin' in connection.headers) && 'origin' in req.headers) { + connection.headers.origin = req.headers.origin; + } + }; +} + // Workaround for node ^8.6.0, ^9.0.0 // DEFAULT_ECDH_CURVE is default to prime256v1 in these version // breaking connection when certificate is not signed with prime256v1 From 4b7a8283f4901a1894bbc93b09d2dcab96ee514b Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Mon, 24 Dec 2018 12:58:05 +0300 Subject: [PATCH 2/2] chore(release): 3.1.14 --- CHANGELOG.md | 10 ++++++++++ package-lock.json | 2 +- package.json | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa0b2dbec0..297cdc9721 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ 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.14](https://github.com/webpack/webpack-dev-server/compare/v3.1.13...v3.1.14) (2018-12-24) + + +### Bug Fixes + +* add workaround for Origin header in sockjs ([#1608](https://github.com/webpack/webpack-dev-server/issues/1608)) ([1dfd4fb](https://github.com/webpack/webpack-dev-server/commit/1dfd4fb)) + + + ## [3.1.13](https://github.com/webpack/webpack-dev-server/compare/v3.1.12...v3.1.13) (2018-12-22) diff --git a/package-lock.json b/package-lock.json index 96af6b6163..daf6094295 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "webpack-dev-server", - "version": "3.1.13", + "version": "3.1.14", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 1bb0077417..3799c6159a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webpack-dev-server", - "version": "3.1.13", + "version": "3.1.14", "description": "Serves a webpack app. Updates the browser on changes.", "bin": "bin/webpack-dev-server.js", "main": "lib/Server.js",