How to fix CORS issues
Problem
Section titled “Problem”It's common for people to hit CORS (Cross-Origin Resource Sharing) issues when using the Resend API. This error typically shows as:
Access to XMLHttpRequest at 'https://api.resend.com/emails'
from origin 'http://localhost:3000' 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.Solution
Section titled “Solution”Usually CORS errors happens when you're sending emails from the client-side.
Send the emails on the server-side to not expose your API keys and avoid CORS issues.