๐ Step 6: Development#444 / 498
CORS
Cross-Origin Resource Sharing (CORS)
๐One-line summary
A browser security rule that checks whether a page from another origin may call your server's API.
โจExample
// CORS (Cross-Origin Resource Sharing (CORS))
๋ค๋ฅธ ์ถ์ฒ(๋๋ฉ์ธ)์ ์น ํ์ด์ง๊ฐ ๋ด ์๋ฒ API๋ฅผ ํธ์ถํด๋ ๋๋์ง ๋ธ๋ผ์ฐ์ ๊ฐ ๊ฒ์ฌํ๋ ๋ณด์ ๊ท์น
> ready_
โกVibe coding prompt examples
>_
The browser console shows 'blocked by CORS policy'. Explain the cause and give code to set allowed origins in a Next.js Route Handler.
>_
Explain the risks of opening CORS with Access-Control-Allow-Origin: * and the correct setup when using cookie auth.
>_
Explain how to work around a CORS error with a server-side proxy route, and when that's appropriate.
Try these prompts in your AI coding assistant!