Django CORS

Learn how to implement CORS in Django REST.

What is CORS?

Cross-Origin Resource Sharing (CORS) is a mechanism based on an HTTP header that allows a server to indicate any origins (domains, ports, or schemes) other than its own from which a browser should permit the loading of resources.

In our case, we have created an authentication API, which is a backend. When hosting this API on a server, the authentication requests to our API come in from a front-end application hosted on another server. For the front-end application to be allowed to request our API, its domain name must be in the list of the domain names in the CORS headers, for security reasons enforced by the browser.

Get hands-on with 1400+ tech skills courses.