Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using web3 with a proxy #2827

Closed
darioAnongba opened this issue May 21, 2019 · 1 comment
Closed

Using web3 with a proxy #2827

darioAnongba opened this issue May 21, 2019 · 1 comment

Comments

@darioAnongba
Copy link

Description

Our company uses web3 with a proxy. Proxies are not officially supported by web3 at the moment but we imperatively need it. We used the hack explained in this ticket: #887 to resolve the issue and it worked fine until web beta.37 but fails now that we updated to web3 beta.55.

The error we get is the following:

Connection refused or URL couldn't be resolved: https://{URL}
This didn't happen with web3 beta.37.

The purpose of this ticket is mostly to ask how to configure web3 with a proxy if anyone has succeeded in doing so.

Expected behavior

Calling await web3.eth.getAccounts() should return successfully using a proxy.

This behavior has been confirmed with integration tests.

Actual behavior

Calling await web3.eth.getAccounts() returns an error: Connection refused or URL couldn't be resolved

Steps to reproduce the behavior

  1. Import web3 and http-proxy-agent
  2. Set the provider with
    this.web3Provider = new Web3.providers.HttpProvider())
    this.web3Provider.httpAgent = new HttpProxyAgent(process.env.HTTP_PROXY)
  1. Call any web3 function

Error Logs

await web3.eth.getAccounts() returns an error: Connection refused or URL couldn't be resolved

Versions

  • web3.js: 1.0.0.beta.55
  • nodejs: 8
  • ethereum node: geth
@nivida
Copy link
Contributor

nivida commented May 22, 2019

Thanks for opening this issue! I will close this one because of the already existing feature request. Feel free to update the HttpProvider in the web3-providers module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants