ONLYOFFICE / Docker-DocumentServer

ONLYOFFICE Document Server is an online office suite comprising viewers and editors for texts, spreadsheets and presentations, fully compatible with Office Open XML formats: .docx, .xlsx, .pptx and enabling collaborative editing in real time.
GNU Affero General Public License v3.0
1.38k stars 475 forks source link

Too many redirects #657

Closed piiskop closed 11 months ago

piiskop commented 1 year ago

Do you want to request a feature or report a bug? bug

What is the current behavior? Too many redirects.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. I installed the document server this way:

sudo docker run -i -t -d -p 112:80 -p 446:443 --restart=always -v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data -v /app/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice -v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql -e LETS_ENCRYPT_DOMAIN=documentserver.onlyoffice.ons.ee -e LETS_ENCRYPT_MAIL=kalmer@ons.ee -e JWT_SECRET=my_jwt_secret onlyoffice/documentserver

The configuration file for nginx has the following content:

server {
       server_name documentserver.onlyoffice.ons.ee;
       location / {
                proxy_connect_timeout   1200;
                proxy_send_timeout      1200;
                proxy_read_timeout      1200;
                send_timeout            1200;
                proxy_set_header        X-Real-IP $remote_addr;
                proxy_set_header        X-Forwarded-For $remote_addr;
                proxy_set_header        Host $host;
                proxy_pass              http://localhost:112;
                proxy_set_header        Upgrade $http_upgrade;
                proxy_set_header        Connection "Upgrade";
                proxy_set_header        X-Forwarded-Proto $scheme;
                add_header              X-Frontent-Host $host;
                client_max_body_size    1024m;
        }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/documentserver.onlyoffice.ons.ee/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/documentserver.onlyoffice.ons.ee/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 = documentserver.onlyoffice.ons.ee) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

       server_name documentserver.onlyoffice.ons.ee;
    listen 80;
    return 404; # managed by Certbot

}

It worked for a day but after restarting the machine, it does not work anymore. Removing the container and reinstalling the image did not make a difference. If I access https://documentserver.onlyoffice.ons.ee/ then I get:

This page isn’t workingdocumentserver.onlyoffice.ons.ee redirected you too many times. Try clearing your cookies. ERR_TOO_MANY_REDIRECTS

What is the expected behavior?

The document server works.

Did this work in previous versions of DocumentServer?

Irrelevant.

DocumentServer Docker tag:

REPOSITORY TAG IMAGE ID CREATED SIZE onlyoffice/documentserver latest 2e2042083288 5 weeks ago 3.05GB

blissful_buck

Host Operating System:

Ubuntu 22.04.3 LTS

igwyd commented 11 months ago

Hello @piiskop, sorry for the late reply. To get certificates from letsencrypt using variables in docker you will have to use 80 and 443 ports, because letsencrypt uses these ports. Duplicate of #347

Rita-Bubnova commented 11 months ago

I close this issue. Feel free to comment or reopen it if you got further questions.