Skip to content
This repository was archived by the owner on Dec 5, 2023. It is now read-only.

Commit c5612f0

Browse files
authored
Merge pull request #732 from unfoldingWord-dev/robh_cors
Add CORS headers
2 parents 3311dad + 0d49a91 commit c5612f0

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ django-appconf==1.0.1
1010
django-bootstrap-form==3.2
1111
django-celery==3.1.17
1212
django-contrib-comments==1.7.1
13+
django-cors-headers==2.4.1
1314
django-model-utils==2.4
1415
django-multiupload==0.5
1516
django-redis-cache==1.6.5

runtime.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
python-2.7.15
1+
python-2.7.17

td/settings.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
SECRET_KEY = os.environ.get("SECRET_KEY", "notasecret")
8282

8383
MIDDLEWARE_CLASSES = [
84+
"corsheaders.middleware.CorsMiddleware",
8485
"reversion.middleware.RevisionMiddleware",
8586
"django.contrib.sessions.middleware.SessionMiddleware",
8687
"django.middleware.common.CommonMiddleware",
@@ -149,6 +150,7 @@
149150
"rest_framework",
150151
"django_comments",
151152
"taggit",
153+
"corsheaders",
152154

153155
# project
154156
"td",
@@ -268,6 +270,14 @@
268270
}
269271
]
270272

273+
# Added RJH Mar2020 for django-cors-headers package
274+
# NOTE: We are using django-cors-headers 2.4.1 to be compatible with Django 1.9
275+
# and it doesn't specify the URI scheme (https://) in the whitelist.
276+
CORS_ORIGIN_WHITELIST = [
277+
"door43.org",
278+
"dev.door43.org",
279+
]
280+
271281

272282
import sentry_sdk
273283
from sentry_sdk.integrations.celery import CeleryIntegration

0 commit comments

Comments
 (0)