NextCloud and ONLYOFFICE Integration not working

Nextcloud version: 20.0.
Operating system and version: Debian 10.6
Apache or nginx version: Apache/2.4.38
PHP version: PHP 7.3.19-1~deb10u1

The issue you are facing:
Hello I am trying to integrate ONLYOffice with NextCloud but its not working.
It is a single server setup with docker. I am receiving the following error:
Error when trying to connect (Error occurred in the document service: Error while downloading the document file to be converted.) (version 6.0.0.105)

I really dont know where my problem is. Thanks for your help! :slight_smile:

Document Editing Service address: https://onlyoffice.xxxxx.de
Secret key: secret

root@NXT-01:~# curl https://onlyoffice.xxxxx.de/healthcheck
true

The output of your Nextcloud log in Admin > Logging:

	Exception: Error occurred in the document service: Error while downloading the document file to be converted.

    /var/www/html/nextcloud/apps/onlyoffice/lib/documentservice.php - line 94:

    OCA\Onlyoffice\DocumentService->ProcessConvServResponceError("-4")

    /var/www/html/nextcloud/apps/onlyoffice/lib/documentservice.php - line 432:

    OCA\Onlyoffice\DocumentService->GetConvertedUri("https://onl ... M", "docx", "docx", "check_1388621977")

    /var/www/html/nextcloud/apps/onlyoffice/controller/settingscontroller.php - line 168:

    OCA\Onlyoffice\DocumentService->checkDocServiceUrl(OC\URLGenerator {}, OCA\Onlyoffice\Crypt {})

    /var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 169:

    OCA\Onlyoffice\Controller\SettingsController->SaveAddress("https://onl ... /", "https://onl ... /", "https://onl ... /", false, "secret", false)

    /var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 100:

    OC\AppFramework\Http\Dispatcher->executeController(OCA\Onlyoffi ... {}, "saveAddress")

    /var/www/html/nextcloud/lib/private/AppFramework/App.php - line 152:

    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Onlyoffi ... {}, "saveAddress")

    /var/www/html/nextcloud/lib/private/Route/Router.php - line 308:

    OC\AppFramework\App::main("SettingsController", "saveAddress", OC\AppFramew ... {}, { action: nu ... "})

    /var/www/html/nextcloud/lib/base.php - line 1009:

    OC\Route\Router->match("/apps/onlyo ... s")

    /var/www/html/nextcloud/index.php - line 37:

    OC::handleRequest()

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'ocn33dhox40p',
  'passwordsalt' => 'xxxxx',
  'secret' => 'xxxxx',
  'trusted_domains' =>
  array (
    0 => '192.168.2.173',
    1 => 'cloud.xxxxxx.de',
    2 => '127.0.0.1:9981',
    3 => 'onlyoffice.xxxxx.de',
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '20.0.0.9',
  'overwrite.cli.url' => 'http://cloud.xxxxxx.de',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextclouduser',
  'dbpassword' => 'xxxxxxx',
  'installed' => true,
  'htaccess.RewriteBase' => '/nextcloud',
  'skeletondirectory' => '',
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'maintenance' => false,
  'allow_local_remote_servers' => true,
   'onlyoffice' =>
   array (
      'verify_peer_off' => true,
      'jwt_secret' => 'secret',
      'jwt_header' => 'AuthorizationJwt'
   )

);

This is how I created the docker container

a2enmod proxy proxy_http proxy_ajp rewrite deflate headers proxy_balancer proxy_connect proxy_html proxy_wstunnel authz_core authn_core setenvif ssl

nano /etc/apache2/sites-available/myoffice.conf

<VirtualHost *:80>
ServerName onlyoffice.xxxxxx.de 
RewriteEngine on
RewriteCond %{SERVER_NAME} =onlyoffice.xxxxx.de
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>


a2ensite myoffice.conf
systemctl reload apache2

Created Lets Encrypt Certificate

certbot --apache -m admin@domain.de -d onlyoffice.xxxxx.de


nano /etc/apache2/sites-available/myoffice-le-ssl.conf 

SSLProxyEngine on
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-GCM-SHA256:AES256+EDH:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384
SSLProtocol    all  -TLSv1 -TLSv1.1 -TLSv1.2
SSLCompression off
SSLHonorCipherOrder on

SetEnvIf Host "^(.*)$" THE_HOST=$1
RequestHeader setifempty X-Forwarded-Proto https
RequestHeader setifempty X-Forwarded-Host %{THE_HOST}e
ProxyAddHeaders Off

ProxyPassMatch (.*)(\/websocket)$ "ws://127.0.0.1:9981/$1$2"
ProxyPass / "http://127.0.0.1:9981/"
ProxyPassReverse / "http://127.0.0.1:9981/"


docker run --name=ONLYOFFICEDOCKER -i -t -d -p 9981:80 \
-e JWT_ENABLED='true' -e JWT_SECRET='secret' --restart=always \
-v /tmp/oo/:/var/www/onlyoffice/Data onlyoffice/documentserver


Both URLS are showing "Document Server is running"
https://onlyoffice.xxxxx.de
http://192.168.2.173:9981


docker exec -it ONLYOFFICEDOCKER /bin/bash

nano /etc/onlyoffice/documentserver/default.json

--> Change rejectUnauthorized to "false"

nano /etc/onlyoffice/documentserver/local.json

--> Change token -> inbox -> header to "AuthorizationJwt"
--> Change token -> outbox -> header to "AuthorizationJwt"

supervisorctl restart all