Django in Azure Web Apps - too many redirects
I've been testing out Azure Web App services lately so I can avoid all of the reverse proxy/server management mumbo jumbo.
When I was deploying my Django app, I hit this issue. I'd try to go to the site in Chrome, but got a "Too many redirects" error. I tried turning off HTTPS redirection in the Azure portal, but to no avail. Nothing in my Sentry logs. The other logs all looked fine, too.
Finally, after like 2 hours of re-looking at my logs, googling, and blaming gunicorn, I looked back at my django settings. Turns out I had done some premature securing of the website and had added SECURE_SSL_REDIRECT = True
. So, of course, that was the issue. As soon as I switched that to False
and redeployed, the issue disappeared.
There you have it. Make sure that SECURE_SSL_REDIRECT = False
. Azure can do all that for you, anyways.