worker CORS issue
i have a simple worker that sends emails with Resend service.
I am making a POST request with formData from my app (Astro app with react components) to send the email.
I get a CORS error: Access to fetch at 'https://email-resend.workers.dev/' from origin 'https://ley-segunda-oportunidad.org' 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. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Does anyone encountered this issue before and found a solution? any help would be greatly appreciated. Thanks 👍
1 Reply
You probably need to respond with 200 and the cors headers to arbitrary OPTIONS requests, can be added with a short if statement at the top of the code