CORS (Cross-Origin Resource Sharing) એક બ્રાઉજર સુરક્ષા પદ્ધતિ છે જે નિયંત્રણ કરે છે કે એક origin થી વેબ પેજ તમારા API ને અલગ origin પર કૉલ કરી શકે છે કે નહીં. FastAPI તેને બિલ્ટ-ઇન CORSMiddleware વડે કૉન્ફિગર કરે છે. જ્યારે અલગ ડોમેન/પોર્ટ પરનો frontend તમારા API ને કૉલ કરે તો તમે CORS ને હિટ કરશો.
CORS જે સમસ્યાને સમાધાન કરે છે
A React app at http://localhost:3000 calling an API at http://localhost:8000 is
CROSS-ORIGIN (different port). The BROWSER blocks the response unless the API
sends CORS headers permitting that origin.
(origin = scheme + host + port)
