bruno icon indicating copy to clipboard operation
bruno copied to clipboard

Disable proxy option not working

Open mhimoma opened this issue 1 year ago • 20 comments

I have checked the following:

  • [X] I use the newest version of bruno.
  • [X] I've searched existing issues and found nothing related to my issue.

Describe the bug

I'm trying to bypass the global proxy settings on my system to reach a service. I Disabled the proxy within the tool (from both global and collection level), but still going through the proxy when I send my request. I use the same settings for postman on same machine and it works fine.

.bru file to reproduce the bug

No response

Screenshots/Live demo link

proxy collection image

mhimoma avatar Jun 03 '24 10:06 mhimoma

Just to make sure: Did you press "Save" on that dialog? It happened to me (and I saw it happen to colleagues) that people forget to press the "save" button on these dialogs.

mjhcorporate avatar Jun 03 '24 11:06 mjhcorporate

I did make sure to save the settings, But no luck !

mhimoma avatar Jun 03 '24 14:06 mhimoma

8/5000

@mjhcorporate hello,I also have the same problem.I use the Clash which is a vpn client that use the 7890 as the proxy port, but when I use the bruno to send a request,it prompt: "Error invoking remote method 'send-http-request': Error: connect ECONNREFUSED 127.0.0.1:7890".In the same time, I confirm that I have turned off the proxy service and have not turned on the Bruno client's own proxy.I even uninstalled Bruno and reinstall, but it still doesn't work。

Some screenshots: 图片

图片

图片

图片

KringMiao avatar Jun 04 '24 04:06 KringMiao

I had the same problem with one colleague and after investigation I found that Bruno use environment variable "HTTP_PROXY" so question is if this is feature or bug :)

image

gemiusz avatar Jun 04 '24 19:06 gemiusz

If you enable http(s) or socks proxy then Bruno uses custom http agents for proxy instead of built-in proxy support in axios, but if proxy is not enabled in bruno then axios built-in proxy support is not disabled and still used and this is the reason why HTTP(S)_PROXY variables are auto-detected.

Axios doc:

// `proxy` defines the hostname, port, and protocol of the proxy server.
  // You can also define your proxy using the conventional `http_proxy` and
  // `https_proxy` environment variables. If you are using environment variables
  // for your proxy configuration, you can also define a `no_proxy` environment
  // variable as a comma-separated list of domains that should not be proxied.
  // Use `false` to disable proxies, ignoring environment variables.
  // `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and
  // supplies credentials.
  // This will set an `Proxy-Authorization` header, overwriting any existing
  // `Proxy-Authorization` custom headers you have set using `headers`.
  // If the proxy server uses HTTPS, then you must set the protocol to `https`. 
  proxy: {
    protocol: 'https',
    host: '127.0.0.1',
    port: 9000,
    auth: {
      username: 'mikeymike',
      password: 'rapunz3l'
    }
  },

https://axios-http.com/docs/req_config

So I think it is bug or not well implemented proxy support in bruno. I think if disabled option is configured in bruno, then bruno should set proxy: false in axios request config when constructing request (or even better it should be always disabled as bruno has it's own http agents for proxy). And I think there should be one more proxy option in bruno config, something like autodetect and in such case similar logic should be applied as in this http agent https://github.com/TooTallNate/proxy-agents/tree/main/packages/proxy-agent#proxy-agent So proxy url is auto detected from environment variables and based on the protocol used in proxy url specific http agent should be used (So if protocol is http(s) then http(s) proxy agent should be used, if protocol is socks then socks proxy agent should be used, etc.)

martinsefcik avatar Jun 04 '24 21:06 martinsefcik

maybe link with explicit bruno proxy configuration ? https://github.com/usebruno/bruno/pull/1883

srvkb01 avatar Jun 05 '24 07:06 srvkb01

@mjhcorporate @martinsefcik @srvkb01 Now I find the reason why I use Bruno to send request but always send to the proxy address, just the vpn client regists some Environment Variables in the windows setting.like this: 图片 Just because of the “http_proxy” and "https_proxy",it is not the Bruno problem.I'm not sure if that's the reason for the other scenes above.Thanks a lot.

KringMiao avatar Jun 05 '24 08:06 KringMiao

@KringMiao

it is not the Bruno problem

Yes, it is, because If I setup in bruno that proxy should be disabled then it should be disabled regardless of whether these proxy environment variables are set or not. Otherwise it is confusing for users.

@srvkb01 Yes, it looks like this PR fixes it this way I suggested, but I still think there should be some another proxy autodetection option for proxy configuration in bruno.

martinsefcik avatar Jun 05 '24 08:06 martinsefcik

Hello again! This is a complete blocker for us, as we cannot remove proxy settings and therefore need to use the disable proxy option within Bruno. Any Ideas about the resolution of this issue or ways to work around it?

mhimoma avatar Jun 10 '24 08:06 mhimoma

@mhimoma You can create script which first set for current process http proxy variables to empty values and then runs bruno.

E.g. like on on this link https://superuser.com/a/1049433 for Windows or similar on others OS.

martinsefcik avatar Jun 11 '24 14:06 martinsefcik

@mhimoma alternatively you can set property (or in script) no_proxy e.g. no_proxy=localhost,*.my.internal.domain,127.0.0.* it will bypass proxy for listed records.

gemiusz avatar Jun 11 '24 20:06 gemiusz

@KringMiao : It's a bruno issue

I can't use upstream bruno because of this. There is a proxy configured on all company's computers that do global internet protection for mortals. For IT guys, we have set up a custom proxy to access external APIs, registries, etc...

When I configure bruno to use the IT proxy (whereas global config or by env), bruno mixed both proxy config, calling the IT proxy with the global proxy port.

The merge request I submitted fix that. I have no trouble with other apps.

I known it's time-consuming to test as you need to configure proxies. I hope it will be merged one day.

Thank you for your work on bruno, it's a very useful tool.

samuel-deal-tisseo avatar Jun 18 '24 14:06 samuel-deal-tisseo

@samuel-deal-tisseo: Hello, Thank you for your reply.

Then I ran into a similar problem in another APP, and I couldn't download the files because the requests were directed to proxies. First I checked the environment variable Settings in Windows, but only from the Bruno problem processing, I did not find any information about http_proxy or https_proxy in the visual interface. With the help of the product staff, I found these two parameters through the [set] command in CMD. I don't know which program injected it, but this foreground looks very different. 图片

Maybe this information will help you deal with this problem, Bruno is a great tool, thank you for your hard work.

KringMiao avatar Jun 19 '24 06:06 KringMiao

Hello @samuel-deal-tisseo, thank your for your contribution!

I tested your release (https://github.com/samuel-deal-tisseo/bruno/releases/tag/v1.12.3-sam) and it does not fix the issue raised here. Disabled the proxy at The tool level but still going through the proxy and having my requests blocked.

mhimoma avatar Jun 24 '24 07:06 mhimoma

@mhimoma : I will look at my patch to see if I missed something, because this issue looks really a lot like mine

samuel-deal-tisseo avatar Jun 24 '24 08:06 samuel-deal-tisseo

Thank you @samuel-deal-tisseo ! As an additional info we use https_proxy , http_proxy, and no_proxy system variables on our machines.

Thank you again for your hard work!

mhimoma avatar Jun 24 '24 09:06 mhimoma

An update related to this issue. I tried to go through the no_proxy env variable to bypass the proxy settings. So listed the service within the env variable, enabled the proxy for Bruno. But the output is same (blocked by proxy), as if Bruno only read https_proxy and http_proxy env variables. NB: With curl I was able to connect to the service.

mhimoma avatar Jun 27 '24 13:06 mhimoma

@mhimoma Bruno directly does not read any proxy related environment variables, but axios or exactly speaking proxy-from-env lib used in axios does and it reads also NO_PROXY, so probably you don't have it configured correctly.

See axios proxy related documentation:

// You can also define your proxy using the conventional http_proxy and // https_proxy environment variables. If you are using environment variables // for your proxy configuration, you can also define a no_proxy environment // variable as a comma-separated list of domains that should not be proxied.

https://github.com/axios/axios/tree/v1.5.1?tab=readme-ov-file#request-config

and proxy-from-env documentation:

NO_PROXY is a list of host names (optionally with a port). If the input URL matches any of the entries in NO_PROXY, then the input URL should be fetched by a direct request (i.e. without a proxy).

https://github.com/Rob--W/proxy-from-env/tree/v1.1.0?tab=readme-ov-file#no_proxy

martinsefcik avatar Jun 27 '24 20:06 martinsefcik

Good afternoon,

I'm one of the colleagues of @mhimoma , we work at the same company and project. We're trying to stablish Bruno as the reference tool for API testing in multiple DEV teams but this issue in the proxy settings is blocking the implementation.

We have more than 100 possible users in this project and if it succeds it can lead to integration of the tool in other projects, which can benefit the community, possibility to get the Premium version of the tool, make suggestions to keep improving Bruno, etc.

Please, can we have the help of someone from Bruno to fix this Proxy Settings thing? We believe this tool has all the potential we're looking for as we would like to perform some advanced tests with databases, automate collections and integrate with third parties if included in the future in the Premium version or any other one.

Thanks a lot for your time and previous messages in this thread to help us! Have a great day!

badanmar avatar Jul 16 '24 12:07 badanmar

@martinsefcik you might check my issue with #2877 .. bruno has a really special proxy implementation..

riskersen avatar Aug 21 '24 18:08 riskersen

It seems this issue has been resolved in our latest releases. Could you please check and let us know if you’re still experiencing the problem? Thanks!

naman-bruno avatar Jan 23 '25 10:01 naman-bruno

Hello! I confirm that this issue have been now resolved. on the GUI setting the proxy off allows us to bypass the system proxy settings. So this can be closed. However, the problem persists at the CLI level, and it's being tracked in here: https://github.com/usebruno/bruno/issues/3138.

Thank you for your efforts.

mhimoma avatar Jan 24 '25 13:01 mhimoma