Added support for multiple hosts in caddy configuration and CSRF_TRUSTED_ORIGINS #22
This commit is contained in:
parent
b78e196fec
commit
fb3bbf3fc5
4 changed files with 13 additions and 8 deletions
|
@ -125,11 +125,13 @@ AUTH_USER_MODEL = "app.User"
|
|||
SESSION_COOKIE_AGE = int(config["app"]["session_cookie_age"])
|
||||
CSRF_COOKIE_SECURE = True
|
||||
SESSION_COOKIE_SECURE = True
|
||||
CSRF_TRUSTED_ORIGINS = [
|
||||
f"https://{config['caddy']['host']}",
|
||||
f"http://{config['caddy']['host']}",
|
||||
f"https://{config['caddy']['host']}:{config['caddy']['https_port']}",
|
||||
f"http://{config['caddy']['host']}:{config['caddy']['https_port']}"]
|
||||
CSRF_TRUSTED_ORIGINS = []
|
||||
|
||||
for host in config['caddy']['hosts']:
|
||||
CSRF_TRUSTED_ORIGINS.append(f"http://{host}")
|
||||
CSRF_TRUSTED_ORIGINS.append(f"https://{host}")
|
||||
CSRF_TRUSTED_ORIGINS.append(f"http://{host}:{config['caddy']['https_port']}")
|
||||
CSRF_TRUSTED_ORIGINS.append(f"https://{host}:{config['caddy']['https_port']}")
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/4.1/topics/i18n/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue