webpack-dev-server 1.16.4 → 1.16.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Server.js +7 -7
- package/package.json +60 -60
package/lib/Server.js
CHANGED
|
@@ -52,11 +52,11 @@ function Server(compiler, options) {
|
|
|
52
52
|
// Init express server
|
|
53
53
|
var app = this.app = new express();
|
|
54
54
|
|
|
55
|
-
app.all("*", (req, res, next)
|
|
55
|
+
app.all("*", function(req, res, next) {
|
|
56
56
|
if(this.checkHost(req.headers))
|
|
57
57
|
return next();
|
|
58
58
|
res.send("Invalid Host header");
|
|
59
|
-
});
|
|
59
|
+
}.bind(this));
|
|
60
60
|
|
|
61
61
|
// middleware for serving webpack bundle
|
|
62
62
|
this.middleware = webpackDevMiddleware(compiler, options);
|
|
@@ -333,10 +333,10 @@ Server.prototype.checkHost = function(headers) {
|
|
|
333
333
|
|
|
334
334
|
// get the Host header and extract hostname
|
|
335
335
|
// we don't care about port not matching
|
|
336
|
-
|
|
336
|
+
var hostHeader = headers.host;
|
|
337
337
|
if(!hostHeader) return false;
|
|
338
|
-
|
|
339
|
-
|
|
338
|
+
var idx = hostHeader.indexOf(":");
|
|
339
|
+
var hostname = idx >= 0 ? hostHeader.substr(0, idx) : hostHeader;
|
|
340
340
|
|
|
341
341
|
// always allow localhost host, for convience
|
|
342
342
|
if(hostname === "127.0.0.1" || hostname === "localhost") return true;
|
|
@@ -346,8 +346,8 @@ Server.prototype.checkHost = function(headers) {
|
|
|
346
346
|
|
|
347
347
|
// also allow public hostname if provided
|
|
348
348
|
if(typeof this.publicHost === "string") {
|
|
349
|
-
|
|
350
|
-
|
|
349
|
+
var idxPublic = this.publicHost.indexOf(":");
|
|
350
|
+
var publicHostname = idxPublic >= 0 ? this.publicHost.substr(0, idxPublic) : this.publicHost;
|
|
351
351
|
if(hostname === publicHostname) return true;
|
|
352
352
|
}
|
|
353
353
|
|
package/package.json
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "webpack-dev-server",
|
|
3
|
-
"version": "1.16.
|
|
4
|
-
"author": "Tobias Koppers @sokra",
|
|
5
|
-
"description": "Serves a webpack app. Updates the browser on changes.",
|
|
6
|
-
"peerDependencies": {
|
|
7
|
-
"webpack": ">=1.3.0 <3"
|
|
8
|
-
},
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"compression": "^1.5.2",
|
|
11
|
-
"connect-history-api-fallback": "^1.3.0",
|
|
12
|
-
"express": "^4.13.3",
|
|
13
|
-
"optimist": "~0.6.1",
|
|
14
|
-
"open": "0.0.5",
|
|
15
|
-
"serve-index": "^1.7.2",
|
|
16
|
-
"sockjs": "^0.3.15",
|
|
17
|
-
"sockjs-client": "^1.0.3",
|
|
18
|
-
"stream-cache": "~0.0.1",
|
|
19
|
-
"strip-ansi": "^3.0.0",
|
|
20
|
-
"supports-color": "^3.1.1",
|
|
21
|
-
"webpack-dev-middleware": "^1.10.2",
|
|
22
|
-
"http-proxy-middleware": "~0.17.1"
|
|
23
|
-
},
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"beautify-lint": "^1.0.4",
|
|
26
|
-
"css-loader": "~0.23.0",
|
|
27
|
-
"eslint": "^1.10.3",
|
|
28
|
-
"eslint-plugin-nodeca": "^1.0.3",
|
|
29
|
-
"file-loader": "~0.9.0",
|
|
30
|
-
"jade": "^1.11.0",
|
|
31
|
-
"jade-loader": "~0.8.0",
|
|
32
|
-
"jsbeautify": "^0.3.6",
|
|
33
|
-
"less": "^2.5.1",
|
|
34
|
-
"less-loader": "~2.2.0",
|
|
35
|
-
"style-loader": "~0.13.0",
|
|
36
|
-
"url-loader": "~0.5.6",
|
|
37
|
-
"webpack": "^1.13.2"
|
|
38
|
-
},
|
|
39
|
-
"license": "MIT",
|
|
40
|
-
"repository": {
|
|
41
|
-
"type": "git",
|
|
42
|
-
"url": "git://github.com/webpack/webpack-dev-server.git"
|
|
43
|
-
},
|
|
44
|
-
"homepage": "http://github.com/webpack/webpack-dev-server",
|
|
45
|
-
"main": "lib/Server.js",
|
|
46
|
-
"bin": "bin/webpack-dev-server.js",
|
|
47
|
-
"files": [
|
|
48
|
-
"lib/",
|
|
49
|
-
"bin",
|
|
50
|
-
"client/",
|
|
51
|
-
"ssl/"
|
|
52
|
-
],
|
|
53
|
-
"scripts": {
|
|
54
|
-
"prepublish": "webpack ./client/live.js client/live.bundle.js --colors --config client/webpack.config.js -p && webpack ./client/index.js client/index.bundle.js --colors --config client/webpack.config.js -p",
|
|
55
|
-
"lint": "eslint bin lib test client/{index,live,socket,webpack.config}.js",
|
|
56
|
-
"beautify-lint": "beautify-lint lib/**.js bin/**.js",
|
|
57
|
-
"beautify": "beautify-rewrite lib/**.js bin/**.js",
|
|
58
|
-
"travis": "npm run lint && npm run beautify-lint && node lib/Server.js"
|
|
59
|
-
}
|
|
60
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "webpack-dev-server",
|
|
3
|
+
"version": "1.16.5",
|
|
4
|
+
"author": "Tobias Koppers @sokra",
|
|
5
|
+
"description": "Serves a webpack app. Updates the browser on changes.",
|
|
6
|
+
"peerDependencies": {
|
|
7
|
+
"webpack": ">=1.3.0 <3"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"compression": "^1.5.2",
|
|
11
|
+
"connect-history-api-fallback": "^1.3.0",
|
|
12
|
+
"express": "^4.13.3",
|
|
13
|
+
"optimist": "~0.6.1",
|
|
14
|
+
"open": "0.0.5",
|
|
15
|
+
"serve-index": "^1.7.2",
|
|
16
|
+
"sockjs": "^0.3.15",
|
|
17
|
+
"sockjs-client": "^1.0.3",
|
|
18
|
+
"stream-cache": "~0.0.1",
|
|
19
|
+
"strip-ansi": "^3.0.0",
|
|
20
|
+
"supports-color": "^3.1.1",
|
|
21
|
+
"webpack-dev-middleware": "^1.10.2",
|
|
22
|
+
"http-proxy-middleware": "~0.17.1"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"beautify-lint": "^1.0.4",
|
|
26
|
+
"css-loader": "~0.23.0",
|
|
27
|
+
"eslint": "^1.10.3",
|
|
28
|
+
"eslint-plugin-nodeca": "^1.0.3",
|
|
29
|
+
"file-loader": "~0.9.0",
|
|
30
|
+
"jade": "^1.11.0",
|
|
31
|
+
"jade-loader": "~0.8.0",
|
|
32
|
+
"jsbeautify": "^0.3.6",
|
|
33
|
+
"less": "^2.5.1",
|
|
34
|
+
"less-loader": "~2.2.0",
|
|
35
|
+
"style-loader": "~0.13.0",
|
|
36
|
+
"url-loader": "~0.5.6",
|
|
37
|
+
"webpack": "^1.13.2"
|
|
38
|
+
},
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "git://github.com/webpack/webpack-dev-server.git"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "http://github.com/webpack/webpack-dev-server",
|
|
45
|
+
"main": "lib/Server.js",
|
|
46
|
+
"bin": "bin/webpack-dev-server.js",
|
|
47
|
+
"files": [
|
|
48
|
+
"lib/",
|
|
49
|
+
"bin",
|
|
50
|
+
"client/",
|
|
51
|
+
"ssl/"
|
|
52
|
+
],
|
|
53
|
+
"scripts": {
|
|
54
|
+
"prepublish": "webpack ./client/live.js client/live.bundle.js --colors --config client/webpack.config.js -p && webpack ./client/index.js client/index.bundle.js --colors --config client/webpack.config.js -p",
|
|
55
|
+
"lint": "eslint bin lib test client/{index,live,socket,webpack.config}.js",
|
|
56
|
+
"beautify-lint": "beautify-lint lib/**.js bin/**.js",
|
|
57
|
+
"beautify": "beautify-rewrite lib/**.js bin/**.js",
|
|
58
|
+
"travis": "npm run lint && npm run beautify-lint && node lib/Server.js"
|
|
59
|
+
}
|
|
60
|
+
}
|