OnlyOffice error when trying to open and edit any office file. A Warning message "The document could not be saved..."

server

#1

Hi, I installed Seafile Server Pro v6.2.1 using nginx, mysql, signed ssl (Certbot) and also installed OnlyOffice according to Seafile Manual “Deployment of DocumentServer via SUBFOLDER” using Docker-ce

I managed to get “Document Server Running” in https://myseafileserver.com/onlyofficeds/welcome/

but every time I open an office file I get the warning: “The document could not be saved…” as shown in the picture:

Here is my nginx.conf:

# Required for only office document server
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;
    }

server {
    listen 80;
    server_name myseafileserver.com;
    rewrite ^ https://$http_host$request_uri? permanent;    # force redirect http to https
    server_tokens off;
}

server {
    listen 443 http2;
        ssl on;
        ssl_certificate /etc/letsencrypt/live/myseafileserver.com/fullchain.pem;        # path to your cacert.pem
        ssl_certificate_key /etc/letsencrypt/live/myseafileserver.com/privkey.pem;    # path to your privkey.pem
        server_name myseafileserver.com;
        proxy_set_header X-Forwarded-For $remote_addr;
        add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
        server_tokens off;
#
# Seahub
#
    location / {
        fastcgi_pass    127.0.0.1:8000;
        fastcgi_param   SCRIPT_FILENAME     $document_root$fastcgi_script_name;
        fastcgi_param   PATH_INFO           $fastcgi_script_name;

        fastcgi_param   SERVER_PROTOCOL        $server_protocol;
        fastcgi_param   QUERY_STRING        $query_string;
        fastcgi_param   REQUEST_METHOD      $request_method;
        fastcgi_param   CONTENT_TYPE        $content_type;
        fastcgi_param   CONTENT_LENGTH      $content_length;
        fastcgi_param   SERVER_ADDR         $server_addr;
        fastcgi_param   SERVER_PORT         $server_port;
        fastcgi_param   SERVER_NAME         $server_name;
        fastcgi_param   REMOTE_ADDR         $remote_addr;
        fastcgi_param   HTTPS               on;
        fastcgi_param   HTTP_SCHEME         https;

        access_log      /var/log/nginx/seahub.access.log;
        error_log       /var/log/nginx/seahub.error.log;
        fastcgi_read_timeout 36000;
        client_max_body_size 0;
    }

#
# Cerbot / Letsencrypt install verification
#
   location '/.well-known/acme-challenge' {
	default_type "text/plain";
	root /opt/certbot-webroot;
    }

#
# Seafile
#
    location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass http://127.0.0.1:8082;
        client_max_body_size 0;
        proxy_connect_timeout  36000s;
        proxy_read_timeout  36000s;
        proxy_send_timeout  36000s;
        send_timeout  36000s;
    }

    location /media {
        root /opt/seafile-server-latest/seahub;
    }

#
# seafdav (webdav)
#
    location /seafdav {
        fastcgi_pass    127.0.0.1:8080;
        fastcgi_param   SCRIPT_FILENAME     $document_root$fastcgi_script_name;
        fastcgi_param   PATH_INFO           $fastcgi_script_name;
        fastcgi_param   SERVER_PROTOCOL     $server_protocol;
        fastcgi_param   QUERY_STRING        $query_string;
        fastcgi_param   REQUEST_METHOD      $request_method;
        fastcgi_param   CONTENT_TYPE        $content_type;
        fastcgi_param   CONTENT_LENGTH      $content_length;
        fastcgi_param   SERVER_ADDR         $server_addr;
        fastcgi_param   SERVER_PORT         $server_port;
        fastcgi_param   SERVER_NAME         $server_name;
        fastcgi_param   HTTPS               on;
        client_max_body_size 0;
        access_log      /var/log/nginx/seafdav.access.log;
        error_log       /var/log/nginx/seafdav.error.log;
    }

#
# Dropshare
#
    location '/dropshare' {
	autoindex on;
        alias /opt/Dropshare;
    }

#
# OnlyOfficeds
#
    location /onlyofficeds/ {

        # THIS ONE IS IMPORTANT ! - Trailing slash !
        proxy_pass http://127.0.0.1:88/;

        proxy_http_version 1.1;
        client_max_body_size 100M; # Limit Document size to 100MB
        proxy_read_timeout 3600s;
        proxy_connect_timeout 3600s;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $proxy_connection;

        # THIS ONE IS IMPORTANT ! - Subfolder and NO trailing slash !
        proxy_set_header X-Forwarded-Host $the_host/onlyofficeds;

        proxy_set_header X-Forwarded-Proto $the_scheme;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

Here is my seahub_settings.py:

# -*- coding: utf-8 -*-
SECRET_KEY = "abrakadabrapatadecabra"

FILE_SERVER_ROOT = 'https://myseafileserver.com/seafhttp'

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'seahub-db',
        'USER': 'seafile',
        'PASSWORD': 'mypassword',
        'HOST': '127.0.0.1',
        'PORT': '3306'
    }
}

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': '127.0.0.1:11211',
    }
}

# Enable Only Office
ENABLE_ONLYOFFICE = True
VERIFY_ONLYOFFICE_CERTIFICATE = True
ONLYOFFICE_APIJS_URL = 'https://myseafileserver.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')

Here is my ccnet.conf:

[General]
USER_NAME = DonaldObama
ID = fab09574264e9c41aaa9183b6d991c9af7b6ef8d
NAME = HillaryTrump
SERVICE_URL = https://myseafileserver.com:8000

[Client]
PORT = 13419

[Database]
ENGINE = mysql
HOST = 127.0.0.1
PORT = 3306
USER = seafile
PASSWD = mypassword
DB = ccnet-db
CONNECTION_CHARSET = utf8

I didn’t find any solution to my problem in the forums, I don’t know what else can I do. Any help would be appreciated.
@DerDanilo @daniel.pan

Thanks!!!


#2

Hi ! I just encounter the same issue. My document server is working (it is already serving a nextcloud instance now). By following the subdomain doc I have the same issue… Did you found a work around or a solution ? I’m looking at the code and it seems that the setup proposed is not working properly when seafile and onlyoffice document server are behind a nginx reverse proxy. I’d be glad to share experience :slight_smile: Thanks/Frederic