Bird
0
0

What is the main purpose of setting SESSION_COOKIE_SECURE = True in Django settings?

easy📝 Conceptual Q11 of 15
Django - Security Best Practices
What is the main purpose of setting SESSION_COOKIE_SECURE = True in Django settings?
ATo allow cookies on both HTTP and HTTPS
BTo make cookies accessible to JavaScript
CTo disable cookies entirely
DTo ensure cookies are only sent over HTTPS connections
Step-by-Step Solution
Solution:
  1. Step 1: Understand what SESSION_COOKIE_SECURE does

    This setting tells Django to only send session cookies over HTTPS connections, preventing them from being sent over insecure HTTP.
  2. Step 2: Analyze the options

    To ensure cookies are only sent over HTTPS connections correctly describes this behavior. The other options do not match the purpose of this setting.
  3. Final Answer:

    To ensure cookies are only sent over HTTPS connections -> Option D
  4. Quick Check:

    SESSION_COOKIE_SECURE = True means HTTPS only [OK]
Quick Trick: Secure cookies only send on HTTPS connections [OK]
Common Mistakes:
MISTAKES
  • Thinking it makes cookies accessible to JavaScript
  • Believing it disables cookies
  • Assuming it allows cookies on HTTP

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes