I’m trying to implement a simple web wallet plugged into Polygon blockchain. I instanciate web3:
const Web3 = require('web3'); const web3 = new Web3(new Web3.providers .HttpProvider("https://rpc-mumbai.matic.today/"))
But when I do XHR requests to get my balance, my web browser blocks the request because the RPC server does not have the right header in its response:
Access to XMLHttpRequest at ‘https://rpc-mumbai.matic.today/’ from origin ‘http://localhost:3000’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
This looks to me like a misconfiguration on rpc-mumbai.matic.today side, as this endpoint surely should be open to any site.
Could this be fixed? Is there a work around?
Thanks in advance for any reply. Keep up the good work!!!