Nextcloud not opening files with Collabora Online

Hello everyone,

I’m trying Nextcloud and Collabora Online on a local environment for the very first time, just for fun. But I’m not being able to open any of the .odt and .docx example documents.

Here’re my settings:

  • MBP M1 macOS Monterey 12.6
  • UTM 3.2.4 (58)
  • Ubuntu 22.04 Jammy Jelly Fish
  • Apache/2.4.52 (Ubuntu)
  • PHP 8.1
  • MariaDB Ver 15.1 Distrib 10.6.7-MariaDB, for debian-linux-gnu (aarch64)
  • Docker 20.10.12, build 20.10.12-0ubuntu4
  • Nextcloud 24.0.5
  • Collabora Online latest Docker pull

Nextcloud is installed under Apache with the following Virtual Host,

<VirtualHost *:80>
  DocumentRoot /var/www/nextcloud/
  ServerName  nextcloud.domain.local

  ErrorLog /var/www/nextcloud/nc-error.log
  CustomLog /var/www/nextcloud/nc-access.log combined

  <Directory /var/www/nextcloud/>
    Require all granted
    AllowOverride All
    Options FollowSymLinks MultiViews

    <IfModule mod_dav.c>
      Dav off
    </IfModule>
  </Directory>
</VirtualHost>

and software configurations in config.php:

<?php
$CONFIG = array (
  'instanceid' => 'id',
  'passwordsalt' => 'salt',
  'secret' => 'secret',
  'trusted_domains' => 
  array (
    0 => 'nextcloud.domain.local',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '24.0.5.1',
  'overwrite.cli.url' => 'http://nextcloud.domain.local',
  'overwriteprotocol' => 'http',
  'htaccess.RewriteBase' => '/',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'user',
  'dbpassword' => 'password',
  'installed' => true,
  'app_install_overwrite' => 
  array (
    0 => 'documentserver_community',
  ),
  'overwritehost' => 'nextcloud.domain.local',
  'allow_local_remote_servers' => true,
);

Collabora Online is run inside a Docker container through the following command line,

sudo docker run -t -d -p 127.0.0.1:9980:9980 -e "aliasgroup1=http://nextcloud\\.domain\\.local:80" -e "username=username" -e 'password=password' -e "extra_params=--o:ssl.enable=false --o:ssl.termination=false" --privileged --restart always collabora/code

with the following Virtual Host,

<VirtualHost *:80>
 ########################################
 # Reverse proxy for Collabora Online
 ########################################
 Options -Indexes

 ServerName collabora.domain.local

 ErrorLog /var/www/nextcloud/coolwsd-error.log
 CustomLog /var/www/nextcloud/coolwsd-access.log combined

 AllowEncodedSlashes NoDecode
 ProxyPreserveHost On

 # static html, js, images, etc. served from coolwsd
 # browser is the client part of Collabora Online
 ProxyPass           /browser http://127.0.0.1:9980/browser retry=0
 ProxyPassReverse    /browser http://127.0.0.1:9980/browser

 # WOPI discovery URL
 ProxyPass           /hosting/discovery http://127.0.0.1:9980/hosting/discovery retry=0
 ProxyPassReverse    /hosting/discovery http://127.0.0.1:9980/hosting/discovery

 # Capabilities
 ProxyPass           /hosting/capabilities http://127.0.0.1:9980/hosting/capabilities retry=0
 ProxyPassReverse    /hosting/capabilities http://127.0.0.1:9980/hosting/capabilities

 # Main websocket
 ProxyPassMatch      "/cool/(.*)/ws$"      ws://127.0.0.1:9980/cool/$1/ws nocanon

 # Admin Console websocket
 ProxyPass           /cool/adminws ws://127.0.0.1:9980/cool/adminws

 # Download as, Fullscreen presentation and Image upload operations
 ProxyPass           /cool http://127.0.0.1:9980/cool
 ProxyPassReverse    /cool http://127.0.0.1:9980/cool

 # Compatibility with integrations that use the /lool/convert-to endpoint
 ProxyPass           /lool http://127.0.0.1:9980/cool
 ProxyPassReverse    /lool http://127.0.0.1:9980/cool
</VirtualHost>

and server configurations in coolwsd.xml:

<config>
	<server_name desc="External hostname:port of the server running coolwsd. If empty, it's derived from the request (please set it if this doesn't work). May be specified when behind a reverse-proxy or when the hostname is not reachable directly." type="string" default="">collabora.domain.local</server_name>
	<ssl desc="SSL settings">
        <enable type="bool" desc="Controls whether SSL encryption between coolwsd and the network is enabled (do not disable for production deployment). If default is false, must first be compiled with SSL support to enable." default="true">false</enable>
        <termination desc="Connection via proxy where coolwsd acts as working via https, but actually uses http." type="bool" default="true">false</termination>
	</ssl>
</config>

I’m able to open the service status, the service metrics, and the admin console. I’m also able to save the Collabora Online-server URL in the Nextcloud administration settings, and see the message Collabora Online server is reachable.

But when I try to open the example document, Welcome to Nextcloud Hub.docx, in Nextcloud, I see the error Failed to load Nextcloud Office - please try again later, and the following console error:

and Apache logs:

127.0.0.1 - - [07/Oct/2022:05:54:26 +0200] "PROPFIND /remote.php/dav/files/name/Documents/Welcome%20to%20Nextcloud%20Hub.docx HTTP/1.1" 207 1443 "-" "Mozilla/5.0>
127.0.0.1 - - [07/Oct/2022:05:54:26 +0200] "GET /apps/richdocuments/index?fileId=9&requesttoken=Imusb5SsEhZjbzh1Cx4UnlyKPmTjp2Im2HetUYWerNw%3D%3AVBLEJP3cZkNXV09GJHNd>
127.0.0.1 - - [07/Oct/2022:05:54:26 +0200] "GET /apps/richdocuments/js/richdocuments-document.js?v=becea89b-0 HTTP/1.1" 200 66534 "-" "Mozilla/5.0 (X11; Ubuntu; Linu>
127.0.0.1 - - [07/Oct/2022:05:54:27 +0200] "GET /cron.php HTTP/1.1" 200 877 "-" "Mozilla/5.0 (X11; Ubuntu; Linux aarch64; rv:105.0) Gecko/20100101 Firefox/105.0"

If I try to open the URL directly in a browser tab, I get the following error,

and Colabora Online server error logs:

wsd-00001-00064 2022-10-07 06:47:15.482704 +0000 [ docbroker_002 ] ERR  loading document exception: Access denied, 403. WOPI::CheckFileInfo failed on: http://nextcloud.domain.local/index.php/apps/richdocuments/wopi/files/9_ocns7lv0gdek?permission=edit| wsd/DocumentBroker.cpp:2263
wsd-00001-00064 2022-10-07 06:47:15.482736 +0000 [ docbroker_002 ] ERR  Failed to add session to [http://nextcloud.domain.local:80/index.php/apps/richdocuments/wopi/files/9_ocns7lv0gdek] with URI [http://nextcloud.domain.local/index.php/apps/richdocuments/wopi/files/9_ocns7lv0gdek?permission=edit]: Access denied, 403. WOPI::CheckFileInfo failed on: http://nextcloud.domain.local/index.php/apps/richdocuments/wopi/files/9_ocns7lv0gdek?permission=edit| wsd/DocumentBroker.cpp:2225
wsd-00001-00064 2022-10-07 06:47:15.482767 +0000 [ docbroker_002 ] ERR  Unauthorized Request while starting session on http://nextcloud.domain.local:80/index.php/apps/richdocuments/wopi/files/9_ocns7lv0gdek for socket #22. Terminating connection. Error: Access denied, 403. WOPI::CheckFileInfo failed on: http://nextcloud.domain.local/index.php/apps/richdocuments/wopi/files/9_ocns7lv0gdek?permission=edit| wsd/COOLWSD.cpp:4615
wsd-00001-00064 2022-10-07 06:47:15.482807 +0000 [ docbroker_002 ] ERR  Invalid or unknown session [008] to remove.| wsd/DocumentBroker.cpp:2308

I’m aware this could be a normal behavior, considering that Collabora Online might expect a Nextcloud request to open a document.

That’s all I’ve got. I feel that the main problem could be related to SSL, but I’m not quite sure.

Anyone having the same issue?
Thank you all in advance for your help.

I’m not really an expert. But can you try, when you run docker, without user and password ?

Thank you very much for your reply, @yostral.

I’ve already tried this before passing the username and password as environment variables, and it didn’t work. I’ll try again though, and keep you posted.

I’m under impression WOPI (underlying protocol of Nextcloud Office integration) only works with TLS/https which requires certificates etc… but I might be wrong…

I assume there is something wrong with DNS or routing between the systems… you need this

image

most likely NC or CODE can’t reach the other system using the exposed URL. See https://docs.nextcloud.com/server/latest/admin_manual/office/troubleshooting.html for troubleshooting guide and Docker Compose for Nextcloud + Collabora + Traefik? - #2 by wwe for docker specific Collabora example

Thank you @wwe for you reply.

This means, I won’t be able to run NC and CODE in a local environment? Would you mind to explain me a little more about it? I’m sorry to ask, but I have no idea how to do this.

Thank you very much for the valuable resources. I’ll take a look and let you know how it goes.

I have no reference handy… so you have to trust me or do your own research. This could be a result of the silly “https everywhere” campaign from Google… but I didn’t dig deeper as in my eyes and my setup there is no reason to run Nextcloud and Collabora internal only - so never tried. Letsencrypt Certs work fast and easy with traefik so TLS and external access is given for me…

I’ve finally solved the problem, by adding the protocol of the Collabora Online-server URL in the Nextcloud administration settings. I didn’t do it the first time, as the message Collabora Online server is reachable was displayed each time I saved the URL:

Now I’m able to do CRUD operations on files.

I’ll keep close all the troubleshooting guides you’ve shared with me @wwe. I’m pretty sure I’ll need them sooner or later.

Have a nice day!

Hi folks - I’m new here and coming from a SOHO install of Alfresco CE.

I’m using the Hannsen (hansonnit.se) 500GB VM, also found in NC’s Github, and I opted (in the guided install) to install the Collabora CODE server.

I recently upgraded from NC24 to NC25 and lost my ability to edit documents inline; a document auto-download became the default action.

Because I use this system in production for myself only, I had to revert my VM to a 24.0.5.1 which was the previous snapshot before updating to NC25.

I’ve followed this thread as closely as I can until the OP’s config where he’s using his own Collabora server unlike my choice for my own CODE server.

Sorry, I don’t have logs because I reverted to an early snapshot without thinking I should grab them.

I’m technically able, but very new to the NC world - could someone kindly point me in the right direction to troubleshoot this?

Many thanks!