From 6d646e3cef7284c0ea0f320701fd0cd3e05fb0d7 Mon Sep 17 00:00:00 2001 From: lohit Date: Wed, 11 Feb 2026 13:38:37 +0000 Subject: [PATCH] fix: pass app-level proxy config to bru.sendRequest (#7113) When collection proxy is set to "inherit", bru.sendRequest was skipping the app-level proxy and falling through directly to system proxy. Now it correctly checks app-level proxy settings first, matching the behavior of normal requests. When appLevelProxyConfig is not provided (e.g. CLI), falls through to system proxy preserving existing behavior. Co-authored-by: Claude Opus 4.6 --- .../src/ipc/network/cert-utils.js | 4 +++ .../src/utils/http-https-agents.ts | 34 ++++++++++++++++--- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/packages/bruno-electron/src/ipc/network/cert-utils.js b/packages/bruno-electron/src/ipc/network/cert-utils.js index 1c6d56046..d0cdb7805 100644 --- a/packages/bruno-electron/src/ipc/network/cert-utils.js +++ b/packages/bruno-electron/src/ipc/network/cert-utils.js @@ -207,6 +207,9 @@ const buildCertsAndProxyConfig = async ({ const collectionProxyConfig = get(brunoConfig, 'proxy', {}); const collectionLevelProxy = interpolateObject(collectionProxyConfig, interpolationOptions); + // Get app-level proxy config from global preferences + const appLevelProxyConfig = preferencesUtil.getGlobalProxyConfig(); + // Get system proxy config const systemProxyConfig = getCachedSystemProxy(); @@ -215,6 +218,7 @@ const buildCertsAndProxyConfig = async ({ options, clientCertificates, collectionLevelProxy, + appLevelProxyConfig, systemProxyConfig }; }; diff --git a/packages/bruno-requests/src/utils/http-https-agents.ts b/packages/bruno-requests/src/utils/http-https-agents.ts index 8e5eef95b..8671779a2 100644 --- a/packages/bruno-requests/src/utils/http-https-agents.ts +++ b/packages/bruno-requests/src/utils/http-https-agents.ts @@ -103,6 +103,7 @@ type GetCertsAndProxyConfigParams = { certs?: ClientCertificate[]; }; collectionLevelProxy?: ProxyConfig; + appLevelProxyConfig?: Record; systemProxyConfig?: SystemProxyConfig; }; @@ -129,6 +130,7 @@ type GetHttpHttpsAgentsParams = { certs?: ClientCertificate[]; }; collectionLevelProxy?: ProxyConfig; + appLevelProxyConfig?: Record; systemProxyConfig?: SystemProxyConfig; }; @@ -210,6 +212,7 @@ const getCertsAndProxyConfig = ({ options, clientCertificates, collectionLevelProxy, + appLevelProxyConfig, systemProxyConfig }: GetCertsAndProxyConfigParams): GetCertsAndProxyConfigResult => { const certsConfig: CertsConfig = {}; @@ -302,12 +305,31 @@ const getCertsAndProxyConfig = ({ proxyConfig = collectionProxyConfigData; proxyMode = 'on'; } else if (!collectionProxyDisabled && collectionProxyInherit) { - // Inherit from system proxy - const { http_proxy, https_proxy } = systemProxyConfig || {}; - if (http_proxy?.length || https_proxy?.length) { - proxyMode = 'system'; + // Inherit from app-level proxy settings + if (appLevelProxyConfig) { + const globalDisabled = get(appLevelProxyConfig, 'disabled', false); + const globalInherit = get(appLevelProxyConfig, 'inherit', false); + const globalProxyConfigData = get(appLevelProxyConfig, 'config', appLevelProxyConfig); + + if (!globalDisabled && !globalInherit) { + // Use app-level custom proxy + proxyConfig = globalProxyConfigData; + proxyMode = 'on'; + } else if (!globalDisabled && globalInherit) { + // App-level also inherits, fall through to system proxy + const { http_proxy, https_proxy } = systemProxyConfig || {}; + if (http_proxy?.length || https_proxy?.length) { + proxyMode = 'system'; + } + } + // else: app-level proxy is disabled, proxyMode stays 'off' + } else { + // No app-level proxy config (e.g. CLI), fall through to system proxy + const { http_proxy, https_proxy } = systemProxyConfig || {}; + if (http_proxy?.length || https_proxy?.length) { + proxyMode = 'system'; + } } - // else: no system proxy available, proxyMode stays 'off' } // else: collection proxy is disabled, proxyMode stays 'off' @@ -409,6 +431,7 @@ const getHttpHttpsAgents = async ({ collectionPath, clientCertificates, collectionLevelProxy, + appLevelProxyConfig, systemProxyConfig, options }: GetHttpHttpsAgentsParams): Promise => { @@ -417,6 +440,7 @@ const getHttpHttpsAgents = async ({ collectionPath, clientCertificates, collectionLevelProxy, + appLevelProxyConfig, systemProxyConfig, options });