Skip to content

Commit

Permalink
Add temporary Access-Control-Allow-Origin header
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood committed Jan 10, 2025
1 parent c193aa7 commit e209156
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions config/middleware.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# TODO: Remove once on AWS
class CorsMiddleware:
def __init__(self, get_response):
self.get_response = get_response

def __call__(self, request):
response = self.get_response(request)
response["Access-Control-Allow-Origin"] = "*"
return response
4 changes: 4 additions & 0 deletions config/settings/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,7 @@ def show_toolbar(request) -> bool:
DEBUG_TOOLBAR_CONFIG = {
"SHOW_TOOLBAR_CALLBACK": show_toolbar,
}

MIDDLEWARE += [
"config.middleware.CorsMiddleware",
]
5 changes: 5 additions & 0 deletions config/settings/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,8 @@
# https://docs.djangoproject.com/en/3.2/ref/contrib/staticfiles/#django.contrib.staticfiles.storage.ManifestStaticFilesStorage

STATICFILES_STORAGE = "django.contrib.staticfiles.storage.ManifestStaticFilesStorage"


MIDDLEWARE += [
"config.middleware.CorsMiddleware",
]

0 comments on commit e209156

Please sign in to comment.