proxy -- canonicalHost, defaultHost

This commit is contained in:
Michael Bradley, Jr 2018-07-15 19:34:33 -05:00 committed by Pascal Precht
parent fc27e710fc
commit d4940a339a
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 4 additions and 2 deletions

View File

@ -6,6 +6,8 @@ let commList = {};
let transactions = {};
let receipts = {};
const {canonicalHost, defaultHost} = require('../utils/host');
const parseRequest = function(reqBody){
let jsonO;
try {
@ -61,7 +63,7 @@ const parseResponse = function(ipc, resBody){
exports.serve = function(ipc, host, port, ws){
let proxy = httpProxy.createProxyServer({
target: {
host,
host: canonicalHost(host),
port: port + constants.blockchain.servicePortOnProxy
},
ws: ws
@ -120,6 +122,6 @@ exports.serve = function(ipc, host, port, ws){
});
}
server.listen(port);
server.listen(port, defaultHost);
return server;
};