+
+ Below values are sourced from your system environment variables and cannot be directly updated in Bruno.
+ Please refer to your OS documentation to change these values.
+
+
+
http_proxy
{http_proxy || '-'}
-
+
https_proxy
{https_proxy || '-'}
-
+
no_proxy
diff --git a/packages/bruno-cli/src/utils/axios-instance.js b/packages/bruno-cli/src/utils/axios-instance.js
index dd38174be..225156484 100644
--- a/packages/bruno-cli/src/utils/axios-instance.js
+++ b/packages/bruno-cli/src/utils/axios-instance.js
@@ -8,9 +8,7 @@ const axios = require('axios');
*/
function makeAxiosInstance() {
/** @type {axios.AxiosInstance} */
- const instance = axios.create({
- proxy: false
- });
+ const instance = axios.create();
instance.interceptors.request.use((config) => {
config.headers['request-start-time'] = Date.now();
diff --git a/packages/bruno-electron/src/ipc/network/index.js b/packages/bruno-electron/src/ipc/network/index.js
index 1f17e64ea..185fbc59f 100644
--- a/packages/bruno-electron/src/ipc/network/index.js
+++ b/packages/bruno-electron/src/ipc/network/index.js
@@ -165,17 +165,32 @@ const configureRequest = async (
}
}
- // proxy configuration
- let proxyConfig = get(brunoConfig, 'proxy', {});
- let proxyMode = get(proxyConfig, 'enabled', 'global');
- if (proxyMode === 'global') {
+ /**
+ * Proxy configuration
+ *
+ * Preferences proxyMode has three possible values: on, off, system
+ * Collection proxyMode has three possible values: true, false, global
+ *
+ * When collection proxyMode is true, it overrides the app-level proxy settings
+ * When collection proxyMode is false, it ignores the app-level proxy settings
+ * When collection proxyMode is global, it uses the app-level proxy settings
+ *
+ * Below logic calculates the proxyMode and proxyConfig to be used for the request
+ */
+ let proxyMode = 'off';
+ let proxyConfig = {};
+
+ const collectionProxyConfig = get(brunoConfig, 'proxy', {});
+ const collectionProxyEnabled = get(collectionProxyConfig, 'enabled', 'global');
+ if (collectionProxyEnabled === true) {
+ proxyConfig = collectionProxyConfig;
+ proxyMode = 'on';
+ } else if (collectionProxyEnabled === 'global') {
proxyConfig = preferencesUtil.getGlobalProxyConfig();
- proxyMode = get(proxyConfig, 'mode', false);
+ proxyMode = get(proxyConfig, 'mode', 'off');
}
- // proxyMode is true, if the collection-level proxy is enabled.
- // proxyMode is 'on', if the app-level proxy mode is turned on.
- if (proxyMode === true || proxyMode === 'on') {
+ if (proxyMode === 'on') {
const shouldProxy = shouldUseProxy(request.url, get(proxyConfig, 'bypassProxy', ''));
if (shouldProxy) {
const proxyProtocol = interpolateString(get(proxyConfig, 'protocol'), interpolationOptions);
diff --git a/packages/bruno-electron/src/store/preferences.js b/packages/bruno-electron/src/store/preferences.js
index 58a3d10f6..33d7a02f8 100644
--- a/packages/bruno-electron/src/store/preferences.js
+++ b/packages/bruno-electron/src/store/preferences.js
@@ -1,6 +1,6 @@
const Yup = require('yup');
const Store = require('electron-store');
-const { get } = require('lodash');
+const { get, merge } = require('lodash');
/**
* The preferences are stored in the electron store 'preferences.json'.
@@ -81,10 +81,22 @@ class PreferencesStore {
}
getPreferences() {
- return {
- ...defaultPreferences,
- ...this.store.get('preferences')
- };
+ let preferences = this.store.get('preferences', {});
+
+ // This to support the old preferences format
+ // In the old format, we had a proxy.enabled flag
+ // In the new format, this maps to proxy.mode = 'on'
+ if (preferences?.proxy?.enabled) {
+ preferences.proxy.mode = 'on';
+ }
+
+ // Delete the proxy.enabled property if it exists, regardless of its value
+ // This is a part of migration to the new preferences format
+ if (preferences?.proxy && 'enabled' in preferences.proxy) {
+ delete preferences.proxy.enabled;
+ }
+
+ return merge({}, defaultPreferences, preferences);
}
savePreferences(newPreferences) {