bruno icon indicating copy to clipboard operation
bruno copied to clipboard

ECONNREFUSED error when using localhost with proxy endpoints

Open Lukenickerson opened this issue 1 year ago • 6 comments

I'm running and testing a local proxy server meant to function as an API gateway. It is built in nodejs express v4.18.2 and http-proxy-middleware v2.0.6, and is currently as simple as possible.

  • One path '/hello' returns "Hello" text.
  • Another path '/auth' is set up as a proxy with a target URL out on the internet (a server I manage) and changeOrigin set to true.
  • Another path '/dog' is also a proxy with a target to this public API: https://dog.ceo/api/breeds/image/random

When hitting the proxied auth endpoint I'm seeing this error:

Error invoking remote method 'send-http-request': Error: connect ECONNREFUSED ::1:443

Related to https://github.com/usebruno/bruno/issues/124 but obviously different.

Details

  • Windows 10
  • Bruno desktop app v1.6.1

Tests

  • ✅✅ When requesting a URL in Bruno that is not proxied, e.g., http://localhost:3201/hello just returns text, I get the response expected. This also works as expected in Postman and the browser (Chrome 120.0.6099.225).
  • ❌ When requesting a URL in Bruno that is proxied, e.g., http://localhost:3201/auth I get the error above.
  • ✅ When requesting the same '/auth' proxied URL in either Postman or the browser, I get the response I would expect (which in my case is a JSON object from the proxied API saying the authentication didn't work because I'm doing a GET and not sending any data).
  • ✅✅ When requesting "http://localhost:3201/dog" in either Bruno, Postman, or the browser, they all work as expected.

Since the "dog" endpoint works, but "auth" does not, I admit there is likely something unusual happening with my target server. But it is disconcerting that Bruno acts different from Postman and the browser.

Lukenickerson avatar Jan 19 '24 17:01 Lukenickerson