CORS (Cross-Origin Resource Sharing) ni mekanizmi ya usalama wa kipeleweke ambayo inakuza kama ukurasa wa wavu kutoka kwa origin moja unaweza kuomba kwenye seva kwenye origin nyingine. Kwa chaguo-msingi, kipeleweke kinazuia maombi ya cross-origin; seva lazima iruhusu wazi kupitia headers za jibu.
Sera ya same-origin na tatizo
Origin = scheme + host + port. These are DIFFERENT origins:
https://app.example.com → https://api.example.com (different host)
http://localhost:3000 → http://localhost:4000 (different port)
Browser blocks the cross-origin request UNLESS the server sends CORS headers allowing it.
