CORS (Cross-Origin Resource Sharing) एक ब्राउज़र सुरक्षा तंत्र है जो नियंत्रित करता है कि एक origin पर एक वेब पृष्ठ अलग origin पर एक सर्वर के लिए अनुरोध कर सकता है या नहीं। डिफ़ॉल्ट रूप से, ब्राउज़र cross-origin अनुरोधों को अवरुद्ध करते हैं; सर्वर को प्रतिक्रिया शीर्षलेख के माध्यम से स्पष्ट रूप से उन्हें अनुमति देनी चाहिए।
same-origin नीति और समस्या
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.
