# Access to XMLHttpRequest at ' ' from origin ' ' has been blocked by CORS policy

**URL:** <https://forum.djangoproject.com/t/access-to-xmlhttprequest-at-from-origin-has-been-blocked-by-cors-policy/39175>\
**Category:** Mystery Errors\
**Created:** [February 27, 2025, 10:14am UTC](https://forum.djangoproject.com/t/access-to-xmlhttprequest-at-from-origin-has-been-blocked-by-cors-policy/39175 "2025-02-27T10:14:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kriwad](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kriwad/32/27157_2.png) [@Kriwad](https://forum.djangoproject.com/u/Kriwad)\
**Post date:** [February 27, 2025, 10:14am UTC](https://forum.djangoproject.com/t/access-to-xmlhttprequest-at-from-origin-has-been-blocked-by-cors-policy/39175/1 "2025-02-27T10:14:15Z")

</div>

Hi i am facing issue here while i am trying to host my project from vercel I got everything right in my settings.py file but got this error over and over while i tried to host my project from vercel . I am using

django 5.1.6  
django-cors-headers: 4.6.0  
djangorestframework: 3.15.2

i am also using react as my frontend framework.  
i also put this file as vercel.json in my backend directory but still got this error

```auto
{
“builds”: [
{
“src”: “backend/wsgi.py”,
“use”: “@vercel/python”,
“config”: { “maxLambdaSize”: “15mb” }
}
],
“routes”: [
{
“src”: “/(.*)”,
“dest”: “backend/wsgi.py”
}
]
}

```

this is my setting file  
please someone help me through this error

```auto
CORS_ALLOW_ALL_ORIGINS =True

ALLOWED_HOSTS = ["*"]
INSTALLED_APPS = [
    
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'api',
    'corsheaders',
    'rest_framework',
    'rest_framework_simplejwt',
]

MIDDLEWARE = [

    'corsheaders.middleware.CorsMiddleware',
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
   
]

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [February 27, 2025, 3:50pm UTC](https://forum.djangoproject.com/t/access-to-xmlhttprequest-at-from-origin-has-been-blocked-by-cors-policy/39175/2 "2025-02-27T15:50:39Z")

</div>

Please identify what versions of Python, Django, and django-cors-headers you are using.
