Skip to content

Commit 5147d2a

Browse files
author
Andrei
committed
Merge pull request #158 from nicola/proxyErrors
reporting errors on proxy
2 parents 7141d4b + 5bfc5dd commit 5147d2a

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎lib/handlers/proxy.js‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ function addProxy (app, path) {
2525
}
2626

2727
debug.settings('Proxy destination URI: ' + uri);
28-
request.get(uri).pipe(res);
28+
29+
request
30+
.get(uri)
31+
.on('error', function (err) {
32+
var status = err.code === 'ENOTFOUND' ? 404 : 500
33+
res.sendStatus(status)
34+
})
35+
.pipe(res)
36+
2937
});
3038
}

0 commit comments

Comments
 (0)