This Fixes CORS

preview_player
Показать описание
Learn how to fix CORS errors and enable cross-origin requests in an API endpoint.

We'll walk through why CORS may be blocking a request, how we can set up response headers to control what origins can make requests to an API endpoint including all and several origins, as well as how to set up OPTIONS endpoints using Vercel Functions to respond to preflight requests.

🧰 Resources

#colbyfayock #api #cors #vercel #webdevelopment
Рекомендации по теме
Комментарии
Автор

Bro you just saved me, THANK YOU!. Suscribed and liked this video

LeHarT
Автор

Wait a minute isn't this a huge security issue in the browsers, that I can easily fetch from a website I just opened up and have that website URL as my origin? Does the IP also point to that website I'm fetching from (in the console) or is it my IP? Is the website allowed to not let people fetch using it's origin?

bandekhoda
Автор

Nice video @colbyfayock! Another workaround I've been trying lately (but need to measure bandwidth usage) is by adding a `rewrites` option to my Next.js config. The source would be the path I want to post to (could be your API), then the destination the original.

I've been using it for file uploads, so this could get expensive $$$$

notrab
Автор

Great video,
Please make complete tutorial on authjs v5, rolebased, customer cookie, client side validations

LearnAlongFaizan
Автор

So I never needed the cors npm package?

vd