Hello,

I’m actually trying to install peertube on my server, but the thing is that there is a redirection loop in my nginx config, and i can’t find it… Can someone help me? Here is my nginx config (of course examples has been replaced with the name of my website

server {
        server_name peertube.example.com;

        location / {
            proxy_buffering                     off;
            proxy_pass                          http://localhost/;
            proxy_redirect                      off;
            client_max_body_size                40G;
        proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
        }

      # Websocket tracker
  location /tracker/socket {
    # Peers send a message to the tracker every 15 minutes
    # Don't close the websocket before this time
    proxy_read_timeout 1200s;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_http_version 1.1;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $host;
    proxy_pass http://localhost;
  }

  location /socket.io {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $host;

    proxy_pass http://localhost;

    # enable WebSockets
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
  }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/peertube.example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/peertube.example.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
    if ($host = peertube.example.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

        server_name peertube.example.com;
    listen 80;
    return 404; # managed by Certbot
}
edited by MattIPv4

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hello,

Request you to refer to below link, which provides the filter and token which needs to be changed:

https://rschu.me/how-to-fix-the-infinite-redirect-loop-with-https-nginx-and-your-ghost-blog-1ae4b1ee07eb

Best Regards,
Sri Charan

  • Hello,

    After reading the page you sent me, I checked my nginx config, and the “X-Forwarded-Proto” value was already set to $scheme. So I changed a few more things to have the same values than this page for the other lines of my config, and I still have this redirection loop.

    Have a nice day,

    Aurélien

Submit an Answer