Are there any special steps to connect an web app to the gethrpc?

testing the webapp locally with ganache works fine.

I have an geth Ethereum node running and started the gethRPC. The web app can't connect to the RPC. Are there any special steps which I have to perform for establishing the connection?

chrome console shows:

OPTIONS http://localhost:8545/ net::ERR_CONNECTION_REFUSED
  • What is the complete command that you used to start the geth node? Also, in your webapp, what is the complete URL that you specified for the geth node? (The URL should have the remote server's hostname, and not localhost) Commented Jan 24, 2018 at 16:58

3 Answers 3


The remote server must be CORS enabled. You can start the geth with the below command.

geth --rpc --rpcapi db,eth,net,web3,personal --cache=2048  --rpcport 8545 --rpcaddr --rpccorsdomain "*"

Network creation and connect to same network

  1. networkid 20 mean private network
  2. default port 60303

geth --networkid 20 --port 60303 --rpc --rpccorsdomain "" --lightkdf --cache 16 --datadir "D:\CHAINDATAFINAL" console


Thanks for the input!

This works for me:

geth --rinkeby --rpc --rpcport "8545" --rpcaddr "" --rpccorsdomain "*" --datadir "/home/Ethereum" console

Just have to read about the Security now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.