Skip to content

Commit 4fdcefc

Browse files
committed
commit message title: Add notebook feature to Experimental Lab with Mapbox integration
1 parent 41849af commit 4fdcefc

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

backend/accounts/auth_views.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@
2020
def _cookie_params() -> dict:
2121
# In production behind HTTPS, cookies must be Secure.
2222
secure = not settings.DEBUG
23-
return {
23+
params = {
2424
"httponly": True,
2525
"secure": secure,
2626
"samesite": "Lax",
2727
"path": "/",
2828
}
29+
domain = getattr(settings, 'COOKIE_DOMAIN', None)
30+
if domain:
31+
params["domain"] = domain
32+
return params
2933

3034

3135
class CsrfView(APIView):

backend/config/settings.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,13 @@
280280
CSRF_COOKIE_SAMESITE = config('CSRF_COOKIE_SAMESITE', default='Lax')
281281
CSRF_COOKIE_HTTPONLY = False
282282

283+
# Share cookies across subdomains when needed (e.g. atonixdev.org + api.atonixdev.org).
284+
# Set COOKIE_DOMAIN=.atonixdev.org in production if the frontend needs to read csrftoken.
285+
COOKIE_DOMAIN = config('COOKIE_DOMAIN', default='').strip() or None
286+
if COOKIE_DOMAIN:
287+
SESSION_COOKIE_DOMAIN = COOKIE_DOMAIN
288+
CSRF_COOKIE_DOMAIN = COOKIE_DOMAIN
289+
283290
# Content Security Policy (start in report-only to avoid breaking third-party assets)
284291
CSP_REPORT_ONLY = config('CSP_REPORT_ONLY', default=True, cast=bool)
285292
CSP_DEFAULT_SRC = ("'self'", 'https:', 'data:')

0 commit comments

Comments
 (0)