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:
- afllcfiles.com (Nextcloud)
- office.afllcfiles.com (Collabora)
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:
- curl -I http://localhost:9980/hosting/discovery -H “Host: afllcfiles.com” → 200 OK
- curl -I https://office.afllcfiles.com/hosting/discovery → 200 OK
- Collabora container starts without error
What Fails:
- curl -I http://localhost:9980/loleaflet/dist/loleaflet.html -H “Host: afllcfiles.com” → 400 Bad Request
- Browser: https://office.afllcfiles.com/loleaflet/dist/loleaflet.html → 400 Bad Request
- Opening docx in Nextcloud: spinner never finishes
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?