Skip to content

Commit 14a9a5c

Browse files
Fix: set SESSION_COOKIE_SECURE=False in dev.
1 parent 61eb097 commit 14a9a5c

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

ecommerce_api/settings/base.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@
2626
]
2727

2828
CORS_ALLOW_CREDENTIALS = True
29+
CORS_ALLOW_HEADERS = [
30+
'accept',
31+
'accept-encoding',
32+
'authorization',
33+
'content-type',
34+
'dnt',
35+
'origin',
36+
'user-agent',
37+
'x-csrftoken',
38+
'x-requested-with',
39+
]
40+
41+
CORS_EXPOSE_HEADERS = ['csrftoken', 'sessionid']
2942

3043
# Application definition
3144
# ╭──────────────────────────────────────────────────────────╮
@@ -426,15 +439,15 @@
426439
SESSION_CACHE_ALIAS = "default"
427440

428441
# Session cookie settings - Fixed for admin compatibility
429-
SESSION_COOKIE_SAMESITE = 'Lax' # Changed from 'None' to 'Lax' for admin compatibility
430-
SESSION_COOKIE_SECURE = False # Set to True in production with HTTPS
442+
SESSION_COOKIE_SAMESITE = 'Lax'
443+
SESSION_COOKIE_SECURE = False
431444
SESSION_COOKIE_HTTPONLY = True # Changed to True for security and admin compatibility
432445
SESSION_COOKIE_AGE = 1209600 # 2 weeks
433446
SESSION_SAVE_EVERY_REQUEST = True # Ensure sessions are saved on every request
434447

435448
# CSRF settings - Updated for better compatibility
436-
CSRF_COOKIE_SAMESITE = 'Lax' # Changed from 'None' to 'Lax'
437-
CSRF_COOKIE_SECURE = False # Set to True in production with HTTPS
449+
CSRF_COOKIE_SAMESITE = 'Lax'
450+
CSRF_COOKIE_SECURE = False
438451
CSRF_COOKIE_HTTPONLY = False # Explicitly set for compatibility
439452
CSRF_TRUSTED_ORIGINS = [
440453
'http://localhost:3000',

0 commit comments

Comments
 (0)