Skip to content

Commit

Permalink
add env vars to configure cors headers
Browse files Browse the repository at this point in the history
  • Loading branch information
sainak committed Nov 7, 2023
1 parent 1a232d7 commit f192491
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions aws/backend.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
"name": "CSRF_TRUSTED_ORIGINS",
"value": "[\"http://care-django-staging\", \"https://care.coronasafe.in\", \"https://careapi.coronasafe.in\", \"https://care.ohc.network\", \"https://careapi.ohc.network\"]"
},
{
"name": "CORS_ALLOWED_ORIGINS",
"value": "[\"https://care.coronasafe.in\", \"https://careapi.coronasafe.in\", \"https://care.ohc.network\", \"https://careapi.ohc.network\", \"https://status.10bedicu.org\"]"
},
{
"name": "CURRENT_DOMAIN",
"value": "https://care.ohc.network"
Expand Down
2 changes: 0 additions & 2 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,6 @@
# https://docs.djangoproject.com/en/dev/ref/settings/#csrf-trusted-origins
CSRF_TRUSTED_ORIGINS = env.json("CSRF_TRUSTED_ORIGINS", default=[])

# https://github.com/adamchainz/django-cors-headers#cors_allow_all_origins-bool
CORS_ORIGIN_ALLOW_ALL = True # WARNING: This is not secure
# https://github.com/adamchainz/django-cors-headers#cors_allowed_origin_regexes-sequencestr--patternstr
# CORS_URLS_REGEX = r"^/api/.*$"

Expand Down
2 changes: 2 additions & 0 deletions config/settings/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
SECURE_CONTENT_TYPE_NOSNIFF = env.bool(
"DJANGO_SECURE_CONTENT_TYPE_NOSNIFF", default=True
)
# https://github.com/adamchainz/django-cors-headers#cors_allowed_origins-sequencestr
CORS_ALLOWED_ORIGINS = env.json("CORS_ALLOWED_ORIGINS", default=[])

# TEMPLATES
# ------------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions config/settings/local.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from .base import * # noqa

# https://github.com/adamchainz/django-cors-headers#cors_allow_all_origins-bool
CORS_ORIGIN_ALLOW_ALL = True

# WhiteNoise
# ------------------------------------------------------------------------------
# http://whitenoise.evans.io/en/latest/django.html#using-whitenoise-in-development
Expand Down

0 comments on commit f192491

Please sign in to comment.