The Python Oracle

SESSION_COOKIE_SECURE=True in Django 2.2 redirects Admin login to itself

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 2 Looping

--

Chapters
00:00 Session_cookie_secure=True In Django 2.2 Redirects Admin Login To Itself
01:26 Accepted Answer Score 4
01:42 Answer 2 Score 0
01:59 Thank you

--

Full question
https://stackoverflow.com/questions/5642...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #django #sessioncookies

#avk47



ACCEPTED ANSWER

Score 4


Actually, the following works.

SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True

It is just that testing in on my development environment, HTTPS is not available.




ANSWER 2

Score 0


It seems the SESSION_COOKIE_SECURE option works correctly only under the HTTPS connection.

But, I have no idea why does it work under HTTP in my local environment with default Django's manage.py runserver but not Nginx / gunicorn in production...