Can't get Nextcloud Office to render Office Documents

When I try to open a document it tries to open but just keeps spinning.

I am a noob at nextcloud and nextcloud office and how it all integrates together. I am not as knowledgeable as it would appear from the below details. In order to make this as helpful as possible, I asked an AI where I could find all the information that the template asks for and summarize the issues. So, I don’t know what some of this means, but apparently it might be helpful in getting it resolved.

Collabora CODE Docker with Apache Reverse Proxy Returns 400 for /loleaflet But /hosting/discovery Works

The Problem:
I’ve been trying to integrate Collabora CODE (Docker) with my Nextcloud (Apache, Ubuntu 22.04) setup using reverse proxy and Let’s Encrypt SSL. The integration mostly works — /hosting/discovery returns 200 OK, but any call to /loleaflet/dist/loleaflet.html returns 400 Bad Request. As a result, Nextcloud Office loads but never opens documents.

Setup Summary:

Environment:

  • Ubuntu 22.04 LTS
  • Docker + Docker Compose
  • Apache2 with SSL (Let’s Encrypt)
  • Collabora CODE in Docker
  • Nextcloud installed at /var/www/nextcloud
  • Public FQDNs:

Docker Compose (docker-compose.yml):
version: ‘3’
services:
collabora:
image: collabora/code:23.05.7.2.1
container_name: collabora
restart: always
cap_add:
- MKNOD
- SYS_ADMIN
environment:
- “domain=afllcfiles\.com”
- “username=admin”
- “password=secretpass”
- “extra_params=–o:ssl.enable=false --o:server_name=office.afllcfiles.com
ports:
- “9980:9980”
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro

Apache Proxy Config (collabora.conf):
<VirtualHost *:443>
ServerName office.afllcfiles.com
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/office.afllcfiles.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/office.afllcfiles.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf

AllowEncodedSlashes NoDecode
SSLProxyEngine On
ProxyPreserveHost On

ProxyPass /loleaflet http://127.0.0.1:9980/loleaflet retry=0
ProxyPassReverse /loleaflet http://127.0.0.1:9980/loleaflet

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

ProxyPassMatch “/lool/(.)/ws$" ws://127.0.0.1:9980/lool/$1/ws
ProxyPassMatch "/lool/(.
)” http://127.0.0.1:9980/lool/$1

ProxyPass / http://127.0.0.1:9980/ retry=0
ProxyPassReverse / http://127.0.0.1:9980/

Header always set Strict-Transport-Security “max-age=15768000; includeSubDomains; preload”

Nextcloud config.php (/var/www/nextcloud/config/config.php):
‘trusted_domains’ =>
array (
0 => ‘afllcfiles.com’,
1 => ‘office.afllcfiles.com’,
),
‘overwrite.cli.url’ => ‘https://afllcfiles.com’,
‘allow_local_remote_servers’ => true,

What Works:

What Fails:

Relevant Docker Log:
ERR #27: Unknown resource: /loleaflet/dist/loleaflet.html

What I’ve Tried:

  • Restarted Apache, Docker, and server
  • Tried various domain values (quoted, escaped)
  • Enabled and disabled ssl in extra_params
  • Confirmed Apache is terminating SSL and proxying plain HTTP
  • allow_local_remote_servers = true in config.php

What I Need Help With:

  • Why does /hosting/discovery work but /loleaflet returns 400?
  • Is the Apache reverse proxy config correct?
  • Known compatibility issues between this version of Collabora and Nextcloud 31.0.6?
  • Other diagnostics or fixes to try?
1 Like

Hello @Harold,

welcome to the Nextcloud community! :handshake:

  1. please review Collabora integration guide
  2. I see the very outdated /lool/ statement in your reverseproxy config, pay attention on current config

Your /hosting/discovery works because it’s a valid endpoint, but /loleaflet/dist/loleaflet.html returns 400 because Collabora expects requests to /loleaflet with the proper Host header matching its configured domain. Your Apache proxy passes afllcfiles.com as Host, but Collabora expects office.afllcfiles.com. Make sure your Docker domain env var matches your Collabora FQDN (office.afllcfiles.com), and your proxy forwards the correct Host header. Also, remove the general ProxyPass / directive to avoid conflicts. This should fix the 400 error and allow documents to load.

1 Like