I get a redirect loop when using SSL middleware to redirect certain urls to HTTPS. What should I do?
My nginx config is set up to forward requests to gunicorn.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are a couple of steps here.
First of all, modify the way your middleware checks for SSL:
Then change your nginx config as follows:
proxy_set_headerwill only be passed on ifssl_protocolis not null, i.e., it’s a secure connection.Restart nginx and you’re done.