PeaceAbolisher commited on
Commit
3359c9d
·
verified ·
1 Parent(s): e50f22e

Update myproject/settings.py

Browse files
Files changed (1) hide show
  1. myproject/settings.py +14 -0
myproject/settings.py CHANGED
@@ -103,3 +103,17 @@ STATIC_URL = 'static/'
103
  STATIC_ROOT = BASE_DIR / "staticfiles"
104
 
105
  DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  STATIC_ROOT = BASE_DIR / "staticfiles"
104
 
105
  DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
106
+
107
+
108
+
109
+ # IMPORTANT: These settings fix CSRF/Cookie issues when running in an iframe (like HF Spaces)
110
+ # ----------------------------------------------------------------------------------------
111
+ CSRF_COOKIE_SAMESITE = 'None'
112
+ SESSION_COOKIE_SAMESITE = 'None'
113
+
114
+ # 'SameSite=None' cookies must be secure (sent over HTTPS).
115
+ CSRF_COOKIE_SECURE = True
116
+ SESSION_COOKIE_SECURE = True
117
+
118
+ # Also ensure you have the proxy trust setting:
119
+ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')