patch CSRF and CI
Some checks failed
ERP CI/CD Pipeline / test (push) Has been cancelled
ERP CI/CD Pipeline / Deploy (server git pull + compose) (push) Has been cancelled

This commit is contained in:
mariomitte
2026-07-10 23:00:06 +02:00
parent 88de1a503a
commit 4c9b6bba96
4 changed files with 69 additions and 16 deletions

View File

@@ -115,7 +115,6 @@ CORS_ALLOW_CREDENTIALS = True
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework_simplejwt.authentication.JWTAuthentication',
'rest_framework.authentication.SessionAuthentication',
),
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',

View File

@@ -4,6 +4,18 @@ DEBUG = True
# ALLOWED_HOSTS = ['localhost', '127.0.0.1', 'backend']
ALLOWED_HOSTS = ['*']
# CSRF trusted origins (env + poznate domene)
CSRF_TRUSTED_ORIGINS = [
origin.strip()
for origin in os.environ.get('CSRF_TRUSTED_ORIGINS', '').split(',')
if origin.strip()
] + [
'https://api-004.captain.mitteworkspace.cloud',
'https://serviseri-004.captain.mitteworkspace.cloud',
'http://localhost:4321',
'http://127.0.0.1:4321',
]
# SQLite za brzi lokalni razvoj (nema potrebe za instalacijom Postgresa na laptopu)
# DATABASES = {
# 'default': {

View File

@@ -23,6 +23,16 @@ CSRF_COOKIE_SECURE = True
# Produkcijski CORS (samo domena na kojoj vrti Astro)
CORS_ALLOWED_ORIGINS = os.environ.get('CORS_ALLOWED_ORIGINS', '').split(',')
# csrf trusted origins za produkciju (env + poznate domene)
CSRF_TRUSTED_ORIGINS = [
origin.strip()
for origin in os.environ.get('CSRF_TRUSTED_ORIGINS', '').split(',')
if origin.strip()
] + [
'https://api-004.captain.mitteworkspace.cloud',
'https://serviseri-004.captain.mitteworkspace.cloud',
]
# Statika i Mediji
STATIC_ROOT = '/app/staticfiles'
MEDIA_ROOT = '/app/media'