[Django]-Django: security middleware is crashing the site

6👍

Infinite-redirects means you have set SECURE_SSL_REDIRECT to True, but in production your site runs behind an SSL-stripping proxy server, so Django can’t tell that the request is already in fact SSL, so it continually tries to redirect to SSL. As noted in the linked docs, you need to figure out what header your proxy sets to indicate an externally-SSL request, and set the SECURE_PROXY_SSL_HEADER setting accordingly.

Using the production settings locally will not work because Django’s development server does not support SSL. The strange terminal output is your browser trying to make an SSL handshake with a server that doesn’t understand SSL.

Leave a comment