Use WebsocketProvider as HttpProvider is deprecated
An attempt to use web3.js with an Ethereum node fails with the following error:
Access to XMLHttpRequest at 'https://user-name:email@example.com'
from origin 'http://12.345.67.890' 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.
You are attempting to use a deprecated HttpProvider.
There is no CORS policy for WebSocket.
Use WebsocketProvider, which is the standard for web3.js.
See also Chainstack Docs: web3.js.