I'm trying to build my first dapp using test-rpc and web3js. I deployed a smart contract (with remix ide) to the testrpc (on linux ubuntu), when executing the following line:
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
web3.eth.defaultAccount = web3.eth.accounts;
I'm getting the following error:
web3.min.js:1 Access to XMLHttpRequest at 'http://localhost:8545/' from origin 'http://127.0.0.1:8777' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute. t.send @ web3.min.js:1 n.send @ web3.min.js:1 t @ web3.min.js:1 u.sendTransaction @ web3.min.js:1 u.execute @ web3.min.js:1 (anonymous) @ (index):105 dispatch @ jquery-3.2.1.slim.min.js:3 q.handle @ jquery-3.2.1.slim.min.js:3
I looked over this error before and one solution that didn't help is to use local http server (chrome browser extension).
I've looked for many similar problems and none of them helped. I'll really appreciate any kind of help.