Skip to content

Commit

Permalink
Merge pull request #139 from ZdruzenieSTROM/csrf-galiba
Browse files Browse the repository at this point in the history
CSRF
  • Loading branch information
kovacspe authored Aug 21, 2024
2 parents 8b58f44 + 39b2bfa commit f94719b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion compose-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
build:
context: .
args:
SETTINGS_MODULE: mas_problem.settings.settings
SETTINGS_MODULE: mas_problem.settings.test_settings
ports:
- "8630:8000"
volumes:
Expand Down
5 changes: 4 additions & 1 deletion mas_problem/settings/prod_settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from .settings import * # pylint: disable=unused-wildcard-import, wildcard-import
from .test_settings import * # pylint: disable=unused-wildcard-import, wildcard-import

DEBUG = False

ALLOWED_HOSTS = [
"masproblem.strom.sk",
]
10 changes: 2 additions & 8 deletions mas_problem/settings/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,8 @@ def read_secret(secret_name: str) -> str:
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['masproblem.strom.sk',
'masproblemtest.strom.sk', 'localhost']

CSRF_TRUSTED_ORIGINS = ['https://masproblem.strom.sk',
'https://www.masproblem.strom.sk',
'http://masproblemtest.strom.sk',
'http://www.masproblemtest.strom.sk'
]
ALLOWED_HOSTS = []

SITE_ID = 1

# Application definition
Expand Down
9 changes: 9 additions & 0 deletions mas_problem/settings/test_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from .settings import * # pylint: disable=unused-wildcard-import, wildcard-import

ALLOWED_HOSTS = [
'masproblemtest.strom.sk',
]

USE_X_FORWARDED_HOST = True

SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")

0 comments on commit f94719b

Please sign in to comment.