Onlyoffice docker documentation errors

The documentation for setting up Onlyoffice with docker at https://manual.seafile.com/docker/pro-edition/deploy_onlyoffice_with_docker/ does not work with the latest Onlyoffice document server 7.5 when setting up the service as a sub-directory.

All examples use the URL path /onlyofficeds to set up in nginx and seahub settings. This works for launching the editor, but there is a POST callback from the document server to the URL https://myserver.org/onlyoffice/editor-callback/ from the Onlyoffice container visible in the logs, which will then result in a 404.

From docker log:

seafile-onlyoffice | [2023-10-23T16:02:14.941] [ERROR] [localhost] [7d30e2a1ebde6650c199] [user@myserver.org] nodeJS - postData error: url = http://myserver.org/onlyoffice/editor-callback/;data = {"key":"zzz","status":1,"users":["dragan.espenschied@myserver.org"],"actions":[{"type":1,"userid":"dragan.espenschied@myserver.org"}],"token":"zzz"} Error: Error response: statusCode:301; headers:{"server":"nginx/1.24.0","date":"Mon, 23 Oct 2023 16:02:14 GMT","content-type":"text/html","content-length":"169","connection":"close","location":"https://seafile.rhizome.org/onlyoffice/editor-callback/"}; body:

If to use the URL path /onlyoffice instead of /onlyofficeds in nginx and seahub configuration, the editor does not load.

A second important issue is that when using HTTPS, it is crucial to set SERVICE_URL in seahub_settings.py to start with HTTPS, otherwise Onlyoffice’s callback will receive a redirect from HTTP to HTTPS and refuse operation.

Question: What URL path to use in the nginx configuration?

Otherwise, the documentation should be changed for the Onlyoffice docker install to contain a remark about changing seahub_settings.py’s SERVICE_URL. Seafile will never throw an error if it remains as HTTP by default, so the error is very likely to go unnoticed.

PS: Using Seafile 10.0.10 docker with the go fileserver.

This is what I use for my nginx config (notice the trailing /)

map $http_x_forwarded_proto $the_scheme {
    default $http_x_forwarded_proto;
    "" $scheme;
}
map $http_x_forwarded_host $the_host {
    default $http_x_forwarded_host;
    "" $host;
}
map $http_upgrade $proxy_connection {
    default upgrade;
    "" close;
}

...

    location /onlyofficeds/ {
        proxy_pass http://oods/;
        proxy_http_version 1.1;
        client_max_body_size 100M;
        proxy_read_timeout 3600s;
        proxy_connect_timeout 3600s;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $proxy_connection;
        proxy_set_header X-Forwarded-Host $the_host/onlyofficeds;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

and in the seahub_settings.py

# OnlyOffice
ENABLE_ONLYOFFICE = True
VERIFY_ONLYOFFICE_CERTIFICATE = True
ONLYOFFICE_APIJS_URL = 'https://example.com/onlyofficeds/web-apps/apps/api/documents/api.js'
ONLYOFFICE_FILE_EXTENSION = ('doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'odt',
'fodt', 'odp', 'fodp', 'ods', 'fods')
ONLYOFFICE_EDIT_FILE_EXTENSION = ('docx', 'pptx', 'xlsx')
ONLYOFFICE_JWT_SECRET = 'your-secret-string'
2 Likes

This is the line in the nginx configuration different from the documentation that makes the setup work. Thank you!!

1 Like

Glad to see it worked!

1 Like