I have an Ubuntu machine running two docker nodes. When I try to access nodes from my web based application, installed on the same machine I keep getting the following error :

web3.min.js:2 Access to XMLHttpRequest at 'http://localhost:8502/' from origin 'http://localhost:8000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Even if my starting command is the following:

CMD exec ./geth --syncmode 'full' --port 30313 --rpc --rpccorsdomain '*' --rpcaddr ''  --rpcport 8503 --rpcapi  personal,db,eth,net,web3,txpool,miner --bootnodes "enode://$bootnodeId@$bootnodeIp:30311" --networkid="1005" --gasprice '1' -unlock $address --password ~/.password --mine

so including : --rpccorsdomain '*'

Result is the same with google chrome and with Firefox. Connection with Metamask is working well.

Can anybody help ?


2 Answers 2


Cross-Origin Resource Sharing is probably not defined right, when REQUESTING because Metamask works fine.

It is likely that you try to access the nodes from a different port (This was at least an issue I had once) otherwise, I would suggest looking at the HEADERs metamask sends to your nodes and try to figure things out from there.

  • Thanks for your reply, below is the calling function: var eth_node_url = 'localhost:8502'; // TODO: remote URL web3.setProvider(new web3.providers.HttpProvider(eth_node_url)); Port is the same as the one used by Metamask. I am trying to find the Metamask header. Sep 22, 2022 at 13:42
  • Did you try this snippet from the docs?. I think this could solve your problem.
    – Throvn
    Sep 22, 2022 at 14:26
  • Thanks, I will try this tomorrow the solution I am trying to install is this one : github.com/etherparty/explorer Sep 22, 2022 at 19:48
  • I think the issue is on the eth node side ... How is it possible to check from container console if the config is correct and which CORS domains are authorise ? Thanks Sep 23, 2022 at 12:57
  • Just tried to update the geth version, but still the same problem ... Sep 29, 2022 at 18:25

This has been fixed at the end by switching to another Linux distrib as host. We tried at the beginning with Lubuntu because we had in our requirements to have something light to be distributed. Moving to a standard Ubuntu client fixed the issue.

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.