Bird
0
0

Which of the following is the correct way to enable HTTPS redirection in Django settings?

easy📝 Syntax Q12 of 15
Django - Security Best Practices
Which of the following is the correct way to enable HTTPS redirection in Django settings?
ASECURE_SSL_REDIRECT = False
BSECURE_SSL_REDIRECT = True
CSESSION_COOKIE_SECURE = False
DCSRF_COOKIE_SECURE = False
Step-by-Step Solution
Solution:
  1. Step 1: Identify the setting for HTTPS redirection

    The setting SECURE_SSL_REDIRECT controls whether Django redirects HTTP requests to HTTPS.
  2. Step 2: Choose the correct value to enable redirection

    Setting SECURE_SSL_REDIRECT = True enables automatic redirection to HTTPS. The other options either disable security or relate to cookies.
  3. Final Answer:

    SECURE_SSL_REDIRECT = True -> Option B
  4. Quick Check:

    Enable HTTPS redirect with SECURE_SSL_REDIRECT = True [OK]
Quick Trick: Set SECURE_SSL_REDIRECT to True to force HTTPS [OK]
Common Mistakes:
MISTAKES
  • Setting SECURE_SSL_REDIRECT to False disables HTTPS redirect
  • Confusing cookie settings with HTTPS redirect
  • Not enabling HTTPS redirect at all

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes