From a669538e7097d4e46608e635b3c0663399197f52 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Fri, 8 Jun 2018 16:59:33 -0400 Subject: [PATCH] Adding proxy to config, and closing on error --- lib/core/proxy.js | 4 ++++ templates/boilerplate/config/blockchain.json | 1 + templates/demo/config/blockchain.json | 1 + 3 files changed, 6 insertions(+) diff --git a/lib/core/proxy.js b/lib/core/proxy.js index c4e00c567..60054a421 100644 --- a/lib/core/proxy.js +++ b/lib/core/proxy.js @@ -14,6 +14,10 @@ exports.serve = function(ipc, host, port, ws){ ws: ws }); + proxy.on('error', function (err, req, res) { + proxy.close(); + }); + proxy.on('proxyRes', (proxyRes) => { let resBody = []; proxyRes.on('data', (b) => resBody.push(b)); diff --git a/templates/boilerplate/config/blockchain.json b/templates/boilerplate/config/blockchain.json index b72f107a1..f80d68c6d 100644 --- a/templates/boilerplate/config/blockchain.json +++ b/templates/boilerplate/config/blockchain.json @@ -12,6 +12,7 @@ "rpcHost": "localhost", "rpcPort": 8545, "rpcCorsDomain": "auto", + "proxy": true, "account": { "password": "config/development/password" }, diff --git a/templates/demo/config/blockchain.json b/templates/demo/config/blockchain.json index 8e299188a..9b7162c0d 100644 --- a/templates/demo/config/blockchain.json +++ b/templates/demo/config/blockchain.json @@ -12,6 +12,7 @@ "rpcHost": "localhost", "rpcPort": 8545, "rpcCorsDomain": "auto", + "proxy": true, "account": { "password": "config/development/password" },