From ffe688eed0e1111e9fadedb09a1875292ac1476b Mon Sep 17 00:00:00 2001 From: Ben Bucksch Date: Fri, 22 May 2020 15:30:46 +0200 Subject: [PATCH] Disable HTTP proxy --- lib/api/discovery/bridge-validation.js | 1 + lib/api/discovery/nupnp.js | 1 + lib/api/http/LocalBootstrap.js | 4 ++-- lib/api/http/RemoteApi.js | 1 + lib/api/http/RemoteBootstrap.js | 1 + lib/api/http/endpoints/endpoint.js | 2 ++ 6 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/api/discovery/bridge-validation.js b/lib/api/discovery/bridge-validation.js index 03c6bef..8485d59 100644 --- a/lib/api/discovery/bridge-validation.js +++ b/lib/api/discovery/bridge-validation.js @@ -29,6 +29,7 @@ module.exports.getBridgeConfig = (bridge, timeout) => { return axios.request({ method: 'get', url: `http://${ipAddress}/api/config`, + proxy: false, timeout: timeout | DATA_TIMEOUT, json: true, }) diff --git a/lib/api/discovery/nupnp.js b/lib/api/discovery/nupnp.js index dff5d32..f9ab3f9 100644 --- a/lib/api/discovery/nupnp.js +++ b/lib/api/discovery/nupnp.js @@ -9,6 +9,7 @@ module.exports.nupnp = function () { return axios.get('https://discovery.meethue.com', { headers: {accept: 'application/json'}, + proxy: false, httpsAgent: caChain.getDiscoveryMeetHueHttpsAgent() }) .catch(err => { diff --git a/lib/api/http/LocalBootstrap.js b/lib/api/http/LocalBootstrap.js index fb73fb1..19feab9 100644 --- a/lib/api/http/LocalBootstrap.js +++ b/lib/api/http/LocalBootstrap.js @@ -61,7 +61,7 @@ module.exports = class LocalBootstrap { , baseUrl = self.baseUrl ; - return axios.get(`${baseUrl}/api/config`, {httpsAgent: new https.Agent({rejectUnauthorized: false})}) + return axios.get(`${baseUrl}/api/config`, {proxy: false, httpsAgent: new https.Agent({rejectUnauthorized: false})}) .then(res => { const bridgeId = res.data.bridgeid.toLowerCase(); @@ -99,7 +99,7 @@ module.exports = class LocalBootstrap { }) .then(agent => { const apiBaseUrl = `${baseUrl}/api` - , transport = new Transport(username, axios.create({baseURL: apiBaseUrl, httpsAgent: agent})) + , transport = new Transport(username, axios.create({baseURL: apiBaseUrl, proxy: false, httpsAgent: agent})) , config = { remote: false, baseUrl: apiBaseUrl, diff --git a/lib/api/http/RemoteApi.js b/lib/api/http/RemoteApi.js index 51eefbc..c774540 100644 --- a/lib/api/http/RemoteApi.js +++ b/lib/api/http/RemoteApi.js @@ -268,6 +268,7 @@ module.exports = class RemoteApi { Authorization: `Bearer ${accessToken}`, 'Content-Type': 'application/json' }, + proxy: false, responseType: 'json' }); diff --git a/lib/api/http/RemoteBootstrap.js b/lib/api/http/RemoteBootstrap.js index cbccabf..aa72903 100644 --- a/lib/api/http/RemoteBootstrap.js +++ b/lib/api/http/RemoteBootstrap.js @@ -115,6 +115,7 @@ module.exports = class RemoteBootstrap { headers: { Authorization: `Bearer ${self.remoteApi.accessToken}` }, + proxy: false, timeout: getTimeout(timeout) } , transport = new Transport(username, axios.create(axiosConfig)) diff --git a/lib/api/http/endpoints/endpoint.js b/lib/api/http/endpoints/endpoint.js index c8ab390..1ce3bec 100644 --- a/lib/api/http/endpoints/endpoint.js +++ b/lib/api/http/endpoints/endpoint.js @@ -97,6 +97,8 @@ class ApiEndpoint { data.url = replacePlaceholders(data.url, data.placeholders, parameters); + data.proxy = false; + if (data._payloadFn) { let payload = data._payloadFn(parameters) , headers = data.headers