Skip to content

Bring the features of django-cors-headers Django core #8

Open
@dilroop-us

Description

@dilroop-us

Code of Conduct

  • I agree to follow Django's Code of Conduct

Package Information

django-cors-headers

Problem

Today, a lot of Django projects need CORS (Cross-Origin Resource Sharing), especially when building APIs, SPAs, or mobile backends. Right now, Django doesn't come with any built-in CORS support. We always have to install Django-cors-headers, even for very basic setups.

Since CORS is so common, especially as Django moves toward more async and API-first development, it would be great if it came built-in and officially supported.

Rationale

Django already takes care of important web security (like CSRF, SSL redirects, clickjacking protection). CORS fits into that same category — it’s a core part of modern web security.

Having CORS middleware built into Django would:

  • Make it easier and faster to set up secure APIs.
  • Avoid needing another extra package for almost every project.
  • Provide official documentation and async compatibility going forward.

django-cors-headers is already the trusted package almost everyone uses — it makes sense to bring it home into Django itself.

Additional Details

django-cors-headers is a widely used, stable package with a clean design. Its functionality could fit naturally under django.middleware, with a few simple settings like allowed origins and credentials. Supporting async would also be important as Django continues to move toward async-native development.

Implementation Details

  • Move the main functionality of django-cors-headers into Django as a new middleware class.
  • Add a few simple settings (example: CORS_ALLOWED_ORIGINS, CORS_ALLOW_CREDENTIALS, etc.).
  • Make sure it works in both normal sync views and async views.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Django CoreThis idea is suitable for inclusion in Django itselfNeeds requirementsThe issue needs further defintion around requirements of the feature..Needs teamThe feature needs a team to be formed to work on it. If you're interested, please comment.

    Type

    No type

    Projects

    Status

    Idea refinement - Team creation - For approval

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions