-
My site is working properly but the issue right now is redirecting http to https, I tried to configure the nginx but every time I get "Too many redirect" eorr, i have clear the cache but with no luck when I add return 301 https://$server_name$request_uri; or rewrite command to server block I got Too many redirect error, I tried to comment this line proxy_pass http://channels-backend when adding the redirect but does not help... daphne.sock file
nginx confg:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
You want the redirect only if the protocol is |
Beta Was this translation helpful? Give feedback.
-
Thanks for your reply and assistance Issue has been solved by: 2- Adding the following lines to setting.py file: Third point is adding --proxy-headers to daphne run command in sock file; but not sure if it has any affect on sharing protocol with Django Best Regards |
Beta Was this translation helpful? Give feedback.
Thanks for your reply and assistance
Yes it has nothing with Daphne..
Issue has been solved by:
1- adding protocol header to nginx:
proxy_set_header X-Forwarded-Proto $scheme;
2- Adding the following lines to setting.py file:
SECURE_SSL_REDIRECT = True
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
Third point is adding --proxy-headers to daphne run command in sock file; but not sure if it has any affect on sharing protocol with Django
Best Regards