ethers.js: CORS stopped working on cdn-cors.ether.io.
This is for the front-end <script>
embed. I just checked my site and this is no longer working:
<script type='text/javascript' integrity='sha384-lx/bREQsHxBzGKC8y4tUIt1LZ/FkCnr/zRfrgW7H+1kJsJmMIFUtxi3FuTwDSQOf' crossorigin='anonymous' src='https://cdn-cors.ethers.io/lib/ethers-5.0.26.umd.min.js'></script>
Throwing:
Access to script at 'https://cdn-cors.ethers.io/lib/ethers-5.0.26.umd.min.js' from origin 'https://MYSITE.COM' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Is there something else we should be doing now?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (8 by maintainers)
I changed from this:
to this:
And resolved my problem.
I don’t know what went wrong. I was able to verify CORS worked using cURL, but in browsers it was indeed failing. I wonder if the pre-flight started including a new field and the OPTIONS was cached without a field browsers require.
I flushed the edge caches and it seems to be working now, but if this happens again, I may disable caching of OPTIONS requests.
Thanks for letting me know!