Go-ethereum: can't use geth node from browser web3.js due to CORS

Created on 6 Sep 2015  路  8Comments  路  Source: ethereum/go-ethereum

I tried :
geth --datadir="1" --networkid 1 --verbosity 4 --autodag --ipcdisable --port 30302 --solc "C:\Program Files\Ethereum 0.9.41\Release\solc.exe" --genesis genesis.json --bootnodes=none --rpcport 8102 --rpcaddr "127.0.0.1" --rpccorsdomain "http://127.0.0.1:8102" console
is not working.

but --rpccorsdomain "*" works fine...

Most helpful comment

geth --rpc --rpccorsdomain "*"

All 8 comments

Could you be slightly more specific when you say "it doesn't work"? What exactly doesn't work?

firefox does not get any data from the geth node, in the firefox console says can't execute CORS

Your CORS domain is the origin domain your website runs on. Currently your 127.0.0.1.8102 would suggest you try to access geth from a web server running on your local machine, but looking at your --rpcport option, I see that you've assigned geth that port. So your CORS configs esentially mean that geth allows itself only to talk to itself :P

if you are running a website from example.com, then you need to set _that_ as the --rpccorsdomain.

thank you --rpccorsdomain "localhost:80" works now from html file.

geth --rpc --rpccorsdomain "http://localhost:8080"
worked for me

geth --rpc --rpccorsdomain "*"

--rpccorsdomain "*" didn't work for me. I'm using --rpccorsdomain=*
Note the = and no quotes

I've installed Apache/PHP to talk to Geth (Using localhost:8545 as the JSON-RPC server).
Is using --rpccorsdomain recommended or even required while using Geth only on a local machine like this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

prene picture prene  路  3Comments

bgrieder picture bgrieder  路  3Comments

VoR0220 picture VoR0220  路  3Comments

keitaj picture keitaj  路  3Comments

freshonline picture freshonline  路  3Comments