File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,22 @@ const webpackDevMiddleware = require('webpack-dev-middleware');
24
24
const OptionsValidationError = require ( './OptionsValidationError' ) ;
25
25
const optionsSchema = require ( './optionsSchema.json' ) ;
26
26
27
+ // Workaround for sockjs@~0.3.19
28
+ // sockjs will remove Origin header, however Origin header is required for checking host.
29
+ // See https://github.com/webpack/webpack-dev-server/issues/1604 for more information
30
+ {
31
+ // eslint-disable-next-line global-require
32
+ const SockjsSession = require ( 'sockjs/lib/transport' ) . Session ;
33
+ const decorateConnection = SockjsSession . prototype . decorateConnection ;
34
+ SockjsSession . prototype . decorateConnection = function ( req ) {
35
+ decorateConnection . call ( this , req ) ;
36
+ const connection = this . connection ;
37
+ if ( connection . headers && ! ( 'origin' in connection . headers ) && 'origin' in req . headers ) {
38
+ connection . headers . origin = req . headers . origin ;
39
+ }
40
+ } ;
41
+ }
42
+
27
43
const clientStats = { errorDetails : false } ;
28
44
const log = console . log ; // eslint-disable-line no-console
29
45
You can’t perform that action at this time.
0 commit comments