summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/server.js b/server.js
index 02c5734..c9aea0b 100644
--- a/server.js
+++ b/server.js
@@ -32,7 +32,16 @@ function SimpleProxy(url) {
self.url = url;
self.handle_request = function(req, res) {
- request(self.url).pipe(res);
+ request(self.url, function(err, response, body) {
+ if (err) {
+ console.log("Simple proxy " + self.url + " failed.");
+ console.log(err);
+ res.end();
+ return;
+ }
+ res.write(body);
+ res.end();
+ });
};
}