2

I'm having an issue with my nginx configuration. I receive the error ERR: TOO MANY REDIRECTS

If I change the var SECURE_SSL_REDIRECT = True to False the error goes away but I believe this is causing issue with my channels setup, my websockets are unable to complete handshake.

I found this link which I think is my problem but I don't know how to fix it. I tried changing proxy_pass http://unix... to https://unix... which causes the redirects to stop but the page won't load.

server {
    server_name myproject.com;

location = /favicon.ico { access_log off; log_not_found off; }

location /static/ {
    alias /home/xx/myproject/static/;
}

location /static/admin/ {
    alias /home/xx/myproject/static/admin/;
}

location /media/ {
    alias /home/xx/myproject/media/;
}

location / {
    include proxy_params;
    proxy_pass http://unix:/home/xx/myproject/myproject.sock;
}

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/myproject.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/myproject.com/privkey.pem; # managed by Certb$
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
if ($host = myproject.com) {
    return 301 https://$host$request_uri;
} # managed by Certbot


listen 80;
server_name myproject.com;
return 404; # managed by Certbot


}
Mint
  • 1,013
  • 1
  • 12
  • 29

0 Answers0