Skip to content

Commit a56e38d

Browse files
authored
Merge pull request #58 from codersforcauses/issue/45-more-fixes-withCSRF
fixes for csrf
2 parents aa21841 + b223cbd commit a56e38d

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

.env.production.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ NEXT_PUBLIC_BACKEND_URL="https://robodrone.codersforcauses.com/api"
77
# BACKEND
88
APP_NAME=DjangoAPI
99
API_SECRET_KEY= CHANGE THIS TO A RANDOM STRING
10-
API_ALLOWED_HOSTS=".localhost 127.0.0.1 [::1]"
10+
API_ALLOWED_HOSTS=".localhost 127.0.0.1 [::1] .codersforcauses.org"
1111

1212
POSTGRES_HOST=db
1313
POSTGRES_NAME=postgres

server/api/settings.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@
3838
else []
3939
)
4040

41+
CSRF_TRUSTED_ORIGINS = (
42+
"http://localhost:3000",
43+
"http://127.0.0.1:3000",
44+
os.environ.get("FRONTEND_URL"),
45+
)
4146

4247
# Application definition
4348

@@ -72,6 +77,7 @@
7277
CORS_ALLOWED_ORIGINS = [
7378
"http://localhost:3000",
7479
"http://127.0.0.1:3000",
80+
os.environ.get("FRONTEND_URL")
7581
]
7682

7783
ROOT_URLCONF = "api.urls"

0 commit comments

Comments
 (0)