MetaMask / metamask-extension

:globe_with_meridians: :electric_plug: The MetaMask browser extension enables browsing Ethereum blockchain enabled websites
https://metamask.io
Other
11.87k stars 4.85k forks source link

Can't connect to geth on Firefox. It works on Chrome. #3595

Closed robertmagier closed 6 years ago

robertmagier commented 6 years ago

I can't connect to my geth server on my local machine. It works fine on Chrome and there is a problem on Firefox. Metamask version 4.2.0

I am running my Geth with this command. geth --datadir .\blokchain_data\ --networkid 9876 --rpc --rpcport 8545 --rpcapi "

>> eth,web3,personal,miner,net,txpool" --unlock 0  --mine --minerthreads 1 --etherbase 0 --targetgaslimit 0x80000000 --rpccorsdomain="chrome-extension://nkbihfbeogaeaoehlef
nkodbefgpgknn" --rpcaddr 127.0.0.1

I was using testrpc and ganache before on localhost:8545 and metamask was workingn fine with this. Then I had to switch to geth and it stopped to work. I uninstalled and installed metamask again thinking that maybe metamask is keeping some local configuration. After re installation configuration doesn't change. I can't delete this network and I don't know where are the local metamask files kept.

Thank you for your help.

robertmagier commented 6 years ago

The problem was caused by:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8545/. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

After adding very simple parameter to geth it worked fine: --rpccorsdomain "*" Whole command is: ``` geth --datadir .\blokchain_data\ --networkid 9876 --rpc --rpcport 8545 --rpcapi "eth,web3,personal,miner,net,txpool,admin,debug,miner,personal" --unlock 0 --mine --minerthreads 1 --etherbase 0 --targetgaslimit 0x80000000 --rpcaddr 127.0.0.1 --rpcco rsdomain "*"