ethereum / wiki

The Ethereum Wiki
https://www.ethereum.org
14.75k stars 2.57k forks source link

'Access-Control-Allow-Origin' error, DAPP Using Meteor page #36

Closed HiroIshikawa closed 6 years ago

HiroIshikawa commented 9 years ago

I followed the instructions but when I run the javascript console on the Meteor site on localhost:3000, I got an error message below.

'“XMLHttpRequest cannot load http://localhost:8545/. Response to preflight request doesn't pass access >control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin >'http://localhost:3000' is therefore not allowed access.”'

I chanaged the command $ geth --rpc --rpccorsdomain “http://localhost:3000 to $ geth --rpc --rpcaddr="localhost" --rpcport="8545" --rpccorsdomain="http://localhost:3000" and > web3.eth.accountsshows the accounts in the network successfully.

Should we modify it, if this is replicable for others too?

psmadja commented 8 years ago

Hello, I have the same issue with geth version 1.4.0 receiving /OPTIONS, geth does not return "Access-Control-Allow-Origin" header --rpccorsdomain="http://localhost:3000" I tried with --rpccorsdomain "http://_" with --rpccorsdoamin '"_"' I saw also this syntax somewhere

what is the correct syntax Thanks Philippe

psmadja commented 8 years ago

Hello, Access-Control-Allow-Origin header is sent using the syntax --rpccorsdomain="*" Cheers, Philippe.

hiddentao commented 8 years ago

Just a note that multiple CORS domains are supported, e.g. --rpccorsdomain="http://localhost:9090 http://localhost:8080"

bellaj commented 7 years ago

Just a note that multiple CORS domains are supported, e.g. --rpccorsdomain="http://localhost:9090 http://localhost:8080"

separated by , --rpccorsdomain "http://19.168.26.128,http://localhost:9090,http://localhost:8080"

sc231985 commented 7 years ago

Any Ideas on this issue.

raky35 commented 6 years ago

Hi, i am also unable to connect local remix to local Mist ,

Remix Error : "Make sure the provider is running and a connection is open (via IPC or RPC). and Browser error : [Error] Failed to load resource: Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin. (localhost, line 0) [Error] XMLHttpRequest cannot load http://localhost:8545/. Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin. send (app.js:195778) isConnected (app.js:195838) isConnected (app.js:194109) setProviderFromEndpoint (app.js:155831) (anonymous function) (app.js:207567) fn (app.js:208851) okListener (app.js:208896)

Please accept my apologies for any ignorance. Thanks, Kind Regards, raky

subhodi commented 6 years ago

@raky35 instead of command line try the following from geth console

admin.startRPC("0.0.0.0",8545, "*", "web3,eth,db,net");

Thrid argument * refers to whitelist all. You can automate this by loading javascript to geth through command line.

jamesray1 commented 6 years ago

Belated reason for why this was closed: https://github.com/ethereum/wiki/wiki#issues-and-pull-requests.