๐Ÿ“– 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!