aragon / client

(Aragon 1) Create and manage decentralized organizations on Ethereum.
https://client.aragon.org
GNU Affero General Public License v3.0
834 stars 275 forks source link

Firefox: does not connect to local ethereum node unless configured under wss #1109

Open xuhcc opened 5 years ago

xuhcc commented 5 years ago

Describe the bug

In network preferences, I can't set ethereum node url to my local geth node running under with ws (rather than wss).

Firefox does not allow going from https to ws.

Mainnet or testnet?

mainnet

Organization

Any organization.

https://mainnet.aragon.org/#/?preferences=/network

To Reproduce

I'm running a geth node with the following command:

geth --syncmode=light --rpc --ws

On Aragon portal:

  1. Go to global preferences.
  2. Change ethereum node to ws://127.0.0.1:8546.
  3. Press "Save changes".
  4. See error "Could not connect to node".

No trace in JS console.

Expected behavior

Web UI should successfully connect to local node.


sohkai commented 5 years ago

@xuhcc I think usually the ws endpoint is on /ws (not 100% sure though), so you might have to use ws://127.0.0.1:8546/ws.

Otherwise, it looks like there might be some CORS settings to turn on: https://ethereum.stackexchange.com/a/11619

xuhcc commented 5 years ago

Hello @sohkai I tried to use ws://127.0.0.1:8546/ws and run geth with --wsorigins="*" flag, but still no connection (and no errors in console).

sohkai commented 5 years ago

@xuhcc Are you able to connect to it via other tools, e.g. wscat?

xuhcc commented 5 years ago

Yes, wscat works:

$ wscat --connect ws://127.0.0.1:8546/
connected (press CTRL+C to quit)
> {"id": 1, "method": "eth_syncing", "params": []}
< {"jsonrpc":"2.0","id":1,"result":false}
xuhcc commented 5 years ago

It appears to work in Chromium, so only Firefox is affected.

sohkai commented 5 years ago

Odd; thanks for testing!

Which version of geth are you using?

xuhcc commented 5 years ago

v1.9.3-stable-cfbb969d/linux-amd64/go1.13

xuhcc commented 5 years ago

Firefox disallows insecure websocket connections when website uses https:

https://stackoverflow.com/questions/11768221/firefox-websocket-security-issue

The solution was to set network.websocket.allowInsecureFromHTTPS setting to true in about:config. Or just run aragon client locally.

sohkai commented 5 years ago

Thanks for figuring this out @xuhcc! We should turn this into a support FAQ :).