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 @@ -43,6 +43,22 @@ const createCertificate = require('./utils/createCertificate');
43
43
const validateOptions = require ( 'schema-utils' ) ;
44
44
const schema = require ( './options.json' ) ;
45
45
46
+ // Workaround for sockjs@~0.3.19
47
+ // sockjs will remove Origin header, however Origin header is required for checking host.
48
+ // See https://github.com/webpack/webpack-dev-server/issues/1604 for more information
49
+ {
50
+ // eslint-disable-next-line global-require
51
+ const SockjsSession = require ( 'sockjs/lib/transport' ) . Session ;
52
+ const decorateConnection = SockjsSession . prototype . decorateConnection ;
53
+ SockjsSession . prototype . decorateConnection = function ( req ) {
54
+ decorateConnection . call ( this , req ) ;
55
+ const connection = this . connection ;
56
+ if ( connection . headers && ! ( 'origin' in connection . headers ) && 'origin' in req . headers ) {
57
+ connection . headers . origin = req . headers . origin ;
58
+ }
59
+ } ;
60
+ }
61
+
46
62
// Workaround for node ^8.6.0, ^9.0.0
47
63
// DEFAULT_ECDH_CURVE is default to prime256v1 in these version
48
64
// breaking connection when certificate is not signed with prime256v1
You can’t perform that action at this time.
0 commit comments