Skip to content

Commit 93bb5a5

Browse files
committed
Added CORS for Sentry
1 parent fcb5551 commit 93bb5a5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

pombola/settings/base.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from pombola.core.logging_filters import skip_unreadable_post
1010
from pombola.hansard.constants import NAME_SET_INTERSECTION_MATCH
1111

12-
import socket
12+
from corsheaders.defaults import default_headers
1313

1414
import sentry_sdk
1515
from sentry_sdk.integrations.django import DjangoIntegration
@@ -220,6 +220,7 @@
220220
MIDDLEWARE_CLASSES += ("debug_toolbar.middleware.DebugToolbarMiddleware",)
221221

222222
MIDDLEWARE_CLASSES += (
223+
'corsheaders.middleware.CorsMiddleware',
223224
'django.middleware.cache.UpdateCacheMiddleware',
224225
'django.middleware.common.CommonMiddleware',
225226
'django.contrib.sessions.middleware.SessionMiddleware',
@@ -232,6 +233,8 @@
232233
'django.middleware.security.SecurityMiddleware',
233234
)
234235

236+
CORS_ALLOW_HEADERS = default_headers + ("HTTP_AUTHORIZATION", "SENTRY-TRACE")
237+
235238
ROOT_URLCONF = 'pombola.urls'
236239

237240
MAPIT_AREA_SRID = 4326
@@ -417,6 +420,7 @@
417420
INFO_POSTS_PER_LIST_PAGE = 10
418421

419422
INSTALLED_APPS = (
423+
'corsheaders',
420424
'django.contrib.auth',
421425
'django.contrib.contenttypes',
422426
'django.contrib.sessions',

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ django-bcrypt==0.9.2
2424
django-pipeline==1.6.13
2525
django-pipeline-compass-rubygem==0.1.9
2626
django-formtools==2.1
27+
django-cors-headers==1.3.1
2728

2829
### API related
2930
djangorestframework==3.4.7

0 commit comments

Comments
 (0)