Skip to content

Commit 8c1d5c6

Browse files
committed
Merge branch 'release/0.2.5'
2 parents aa9f369 + c7b10db commit 8c1d5c6

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

Diff for: lib/middleware/backend.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ exports = module.exports = function backend() {
1010

1111
var XRegExp = require("xregexp").XRegExp;
1212
var httpProxy = require("http-proxy");
13-
var BASE_CONFIG = { target: { "protocol": "HTTP" } };
14-
var proxy = new httpProxy.createProxyServer(BASE_CONFIG);
13+
var proxy = new httpProxy.RoutingProxy();
1514

1615
var options = Array.prototype.map.call(arguments, function (option) {
1716
[ REGEXP, PROXY].forEach(function (property) {
@@ -25,11 +24,6 @@ exports = module.exports = function backend() {
2524
return option;
2625
});
2726

28-
proxy.on("error", function (err, req, res) {
29-
res.writeHead(500, { 'Content-Type': 'text/plain' });
30-
res.end(err);
31-
});
32-
3327
function copy(source) {
3428
var target;
3529

@@ -91,8 +85,7 @@ exports = module.exports = function backend() {
9185

9286
if (matches) {
9387
option = transform(copy(option), matches);
94-
95-
proxy.web(request, response, { target: option[PROXY] });
88+
proxy.proxyRequest(request, response, option[PROXY]["target"]);
9689

9790
return true;
9891
}

Diff for: package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "devserver",
3-
"version": "0.2.4",
3+
"version": "0.2.5",
44
"description": "Simple local development server",
55
"author": {
66
"name": "Mikael Karon",
@@ -17,7 +17,7 @@
1717
"dependencies": {
1818
"connect": "~2",
1919
"cli": "~0",
20-
"http-proxy": "~1",
20+
"http-proxy": "~0",
2121
"pause": "~0",
2222
"send": "~0",
2323
"xregexp": "~2"
@@ -35,4 +35,4 @@
3535
"scripts": {
3636
"test": "grunt test"
3737
}
38-
}
38+
}

0 commit comments

Comments
 (0)