From 8c1a749a5a1cf4aad10eba83da4191f40fcd5870 Mon Sep 17 00:00:00 2001 From: Ben Hardill Date: Wed, 12 May 2021 11:08:57 +0100 Subject: [PATCH] Fix msg.responseUrl The original version would pick up the proxy servers port number --- .../@node-red/nodes/core/network/21-httprequest.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/node_modules/@node-red/nodes/core/network/21-httprequest.js b/packages/node_modules/@node-red/nodes/core/network/21-httprequest.js index 00226d3fd..bc434f453 100644 --- a/packages/node_modules/@node-red/nodes/core/network/21-httprequest.js +++ b/packages/node_modules/@node-red/nodes/core/network/21-httprequest.js @@ -364,7 +364,7 @@ module.exports = function(RED) { proxyOptions.proxy.password = proxyPassword; } } - //need both incase of http -> https redirec + //need both incase of http -> https redirect opts.agent = { http: new HttpProxyAgent(proxyOptions), https: new HttpsProxyAgent(proxyOptions) @@ -385,13 +385,7 @@ module.exports = function(RED) { got(url,opts).then(res => { msg.statusCode = res.statusCode; msg.headers = res.headers; - let hostname = res.req.host; - if (res.req.protocol === "http:" && res.socket.remotePort !== 80) { - hostname = `${hostname}:${res.socket.remotePort}` - } else if (res.req.protocol === "https:" && res.socket.remotePort !== 443) { - hostname = `${hostname}:${res.socket.remotePort}` - } - msg.responseUrl = `${res.req.protocol}//${hostname}${res.req.path}`; + msg.responseUrl = res.url; msg.payload = res.body; msg.redirectList = redirectList; msg.retry = 0;