Access to IPFS has been blocked by CORS policy

Access to XMLHttpRequest at ‘https://infura-ipfs.io/ipfs/QmSKTyXiXk663DB51QEhE4GBgEbZ8YWPaZqdN6zg6ZEH4g’ from origin ‘http://localhost:3000’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
Annotation 2022-12-11 170549

This error occurred in next.js.
what can be done to fix this error?

Hey @Armstrong_Bamidele ,

The gateway you are using has been deprecated. Please follow this guide to set up a dedicated gateway and edit your code to output the IPFS urls with the updated gateway+cid. https://blog.infura.io/post/introducing-ipfs-dedicated-gateways

Let us know if you continue to experience cors issues after that change.

Thank you!
Alex | Infura Support Team | Consensys

Thanks so much. The solution you provided worked.