Skip to content

Commit afbc655

Browse files
authored
Merge pull request #73 from Ronak-23/main
Adds CORS header
2 parents 393e005 + 4fbfca5 commit afbc655

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

backend/family_tree/family_tree/settings.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
'django.contrib.sessions',
4141
'django.contrib.messages',
4242
'django.contrib.staticfiles',
43+
'corsheaders',
4344
]
4445

4546
MIDDLEWARE = [
@@ -50,6 +51,7 @@
5051
'django.contrib.auth.middleware.AuthenticationMiddleware',
5152
'django.contrib.messages.middleware.MessageMiddleware',
5253
'django.middleware.clickjacking.XFrameOptionsMiddleware',
54+
'corsheaders.middleware.CorsMiddleware',
5355
]
5456

5557
ROOT_URLCONF = 'family_tree.urls'
@@ -72,6 +74,16 @@
7274

7375
WSGI_APPLICATION = 'family_tree.wsgi.application'
7476

77+
# CORS
78+
79+
CORS_ORIGIN_WHITELIST = [
80+
'http://localhost:3000',
81+
'https://localhost:3000',
82+
'http://127.0.0.1:3000',
83+
'https://127.0.0.1:3000',
84+
]
85+
86+
CORS_ALLOW_CREDENTIALS = True
7587

7688
# Database
7789
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases

0 commit comments

Comments
 (0)