Access to IPFS has been blocked by CORS policy

Access to XMLHttpRequest at ‘’ 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.

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.