diff --git a/lib/Server.js b/lib/Server.js index 7f122e34d6..b462131a77 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -52,6 +52,7 @@ function Server(compiler, options, _log) { this.sockets = []; this.contentBaseWatchers = []; this.watchOptions = options.watchOptions || {}; + this.sockjsUrl = options.sockjsUrl || '/sockjs-node'; // Listening for events const invalidPlugin = () => { @@ -611,7 +612,7 @@ Server.prototype.listen = function (port, hostname, fn) { }); sockServer.installHandlers(this.listeningApp, { - prefix: '/sockjs-node' + prefix: this.sockjsUrl }); if (fn) { diff --git a/lib/optionsSchema.json b/lib/optionsSchema.json index 572a7955a8..ad7ec37ea6 100644 --- a/lib/optionsSchema.json +++ b/lib/optionsSchema.json @@ -341,6 +341,10 @@ "warn": { "description": "Customize warn logs for webpack-dev-middleware.", "instanceof": "Function" + }, + "sockjsUrl": { + "description": "Customize url at which the sockjs server listens, defaults to /sockjs-node", + "type": "string" } }, "type": "object"