What is Origin in FastAPI?
An origin is basically the combination of the protocol, domain, and port on which the application is running. So for two urls even if one of the three combinations is different those urls will said to be of a different origin. The following URLs are all said to be of a different origin:
http://localhost
http://localhost:5000
https://localhost:5000
Configuring CORS in FastAPI
In this article, we are going to see what is an Origin, what is CORS, and how CORS can be used to enable different origins to access and share resources. We will see why the CORS issue occurs when the frontend and backend is present in different origin and how the browser sends a request to the server.