Skip to content

Document fails to load after successful WSS handshake (old version Nextcloud Office 8.6.1 works perfectly) #4695

@wingerdewing

Description

@wingerdewing

Environment information

  • Nextcloud version: 31.0.4.1
  • Richdocuments app version: 8.6.4 (Problem also observed briefly with 8.6.3 during testing)
  • Collabora Docker image: collabora/code:latest (Image ID starting c9186... as of 2025-04-23, CODE version 24.04.13.3)
  • Collabora Host OS: Debian 12 (bookworm), Kernel 6.1.0-33-amd64
  • Reverse Proxy: Apache/2.4.62 (Debian) (on the same host as Docker)
  • Database: MariaDB 10.11.11
  • PHP version: 8.2.28 (cli) with OPcache
  • Client OS/Browser: Linux / Firefox 137 & Chrome 135 (Problem occurs in both)

Important Version Information

When I am downgrading to Nextcloud Office 8.6.1 everything works without a problem!

Describe the bug

Setting up Collabora Online (via Docker) with Nextcloud behind an Apache reverse proxy fails when trying to open an office document (.odt, .docx, etc.).

  1. The Nextcloud Admin Settings -> Office page correctly reports "Collabora Online Server is reachable." and displays the correct HTTPS URL for the Collabora server (https://office.mysite.com) after saving.
  2. Direct curl requests from the Nextcloud server to the Collabora proxy URL (https://office.mysite.com/hosting/discovery and /hosting/capabilities) return valid responses (Status 200 OK, correct JSON/XML content).
  3. When attempting to open an .odt document (newly created or existing):
    • The Nextcloud UI shows the loading indicator.
    • Browser Developer Tools (Network Tab) show a successful WebSocket handshake (Status 101 Switching Protocols) to wss://office.mysite.com/cool/.../ws.
    • The Collabora server sends the initial coolclient ... load url=... message via the established WebSocket.
    • No visible errors are reported in the Browser Console.
    • After a timeout, Nextcloud displays the error message: "Failed to load document. Nextcloud Office could not be loaded - please try again later".

Steps to reproduce

  1. Set up Nextcloud 31.0.4.1 with Richdocuments 8.6.4.
  2. Set up Collabora Online (collabora/code:latest) via Docker behind an Apache 2.4 reverse proxy on the same host, using the provided Apache config and Docker script (see Server details below).
  3. Configure the Collabora server URL (https://office.mysite.com) in Nextcloud Admin -> Office settings and save. Verify that the connection check is successful and shows the correct HTTPS URL.
  4. Go to the Nextcloud Files app.
  5. Click on any .odt or .docx file.
  6. Observe the loading screen within Nextcloud.
  7. See the error "Failed to load document..." after a timeout.
  8. Observe Browser Dev Tools: Network tab shows successful WSS handshake (101), Console tab shows only the final timeout error from Office.vue.
  9. Observe Collabora Docker logs (with debug level): Shows successful CheckFileInfo followed by Error while invoking onFinished client callback: Access to file denied.

Expected behavior

The document should open within the Collabora Online editor embedded in Nextcloud after the WebSocket connection is established.

Actual behavior

The document fails to load with a generic error message in Nextcloud, despite a successful WebSocket handshake. Debug logs from Collabora reveal an internal error after successfully receiving file metadata from Nextcloud.

Configuration of the richdocuments app
(Output of ./occ config:list richdocuments)

{
    "apps": {
        "richdocuments": {
            "canonical_webroot": "",
            "disable_certificate_verification": "yes",
            "enabled": "yes",
            "external_apps": "",
            "installed_version": "8.6.4",
            "public_wopi_url": "https:\/\/office.mysite.com",
            "types": "prevent_group_restriction",
            "wopi_allowlist": "",
            "wopi_url": "https:\/\/office.mysite.com"
        }
    }
}
Relevant Configurations (Anonymized)

Apache VirtualHost (office.mysite.com.conf):

# ==============================================================================
# Apache VirtualHost für Collabora Online Reverse Proxy
# STAND: Reproduktion "Backend OK" (Final)
# ==============================================================================
<VirtualHost *:443>
    ServerName office.mysite.com # Anonymized

    # --- SSL Konfiguration ---
    SSLEngine On
    # Replace with your actual certificate paths
    SSLCertificateFile /path/to/your/certificate.pem
    SSLCertificateKeyFile /path/to/your/private.key

    # --- Proxy Grundeinstellungen ---
    ProxyTimeout 300
    AllowEncodedSlashes NoDecode
    SSLProxyEngine On
    ProxyPreserveHost On
    # ProxyAddHeaders On # Standard, Apache fügt X-Forwarded-* hinzu.

    # --- Logging ---
    ErrorLog ${APACHE_LOG_DIR}/office.mysite.com_error.log # Anonymized
    ServerSignature Off
    CustomLog ${APACHE_LOG_DIR}/office.mysite.com_access.log combined # Anonymized

    # --- Proxy Weiterleitungsregeln ---
    ProxyPass /hosting/discovery http://127.0.0.1:9980/hosting/discovery retry=0
    ProxyPassReverse /hosting/discovery http://127.0.0.1:9980/hosting/discovery

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

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

    ProxyPass /cool/adminws ws://127.0.0.1:9980/cool/adminws nocanon

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

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

    # --- Sicherheit ---
    ProxyRequests Off
    <Proxy *>
        Require all granted
    </Proxy>
    <Location />
        Require all granted
    </Location>

    # --- Header Manipulation ---
    RequestHeader set X-Forwarded-Proto "https"

    # --- Zusätzliche Sicherheitsheader ---
    Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"

</VirtualHost>

1. Docker Image:
collabora/code:latest

2. Docker Run Command:

The container was launched using the following command:

docker run -d \
  --name collabora \
  -p 127.0.0.1:9980:9980 \
  -e "aliasgroup1=https://mysite\\.com" \
  -e "extra_params=--o:logging.level=none" \
  -e "systemplate_readonly=false" \
  --memory="3g" \
  --memory-swap="3g" \
  --restart always \
  --cap-add MKNOD \
  --add-host "office.mysite.com:172.17.0.1" \
  --add-host "mysite.com:172.17.0.1" \
  -e 'username=admin' \
  -e 'password=test' \
  -v "/opt/collabora/coolwsd/coolwsd.xml:/etc/coolwsd/coolwsd.xml:ro" \
  -v "/opt/collabora/cache:/opt/cool/cache" \
  collabora/code:latest

(Note: The admin password is a placeholder here)

3. coolwsd.xml Modifications:

The default /etc/coolwsd/coolwsd.xml from the image was modified using xmlstarlet before mounting it into the container. The following changes were applied:

  • //net/proto: Set value to IPv4.
  • //net/post_allow: A new <host> entry was added: <host desc="Own public server IP" allow="true">185.*****</host>.
  • //logging/level: Set value to none.
  • //logging/level_startup: Set value to none.
  • //net/service_root: Set value to an empty string ("").
  • //remote_font_config/url: Set value to https://mysite.com/nextcloud/index.php/apps/richdocuments/settings/fonts.json
Logs

Nextcloud log (data/nextcloud.log)

(Set loglevel => 0 in config.php first)

# PASTE RELEVANT NEXTCLOUD LOG OUTPUT HERE
# Especially look for errors related to richdocuments or WOPI around the time of opening the document.
# Check if there are any entries related to the failed call to /wopi/settings?type=systemconfig

Collabora log (docker logs collabora - with debug level)

(Captured when trying to open the document)

# PASTE ANONYMIZED COLLABORA DEBUG LOGS HERE
# Ensure logs show the successful CheckFileInfo followed by the "Access to file denied" error in the callback,
# ideally pointing to the request for /wopi/settings?type=systemconfig.
wsd-... [ websrv_poll ] DBG  #YY: WOPI::CheckFileInfo (XXXms): {"BaseFileName":"...", "UserCanWrite":true, ...}
wsd-... [ websrv_poll ] DBG  Getting settings from [https://mysite.com/.../wopi/settings?type=systemconfig...]
wsd-... [ websrv_poll ] DBG  #-1: starting asyncRequest: GET mysite.com:443 /nextcloud/.../wopi/settings?...
wsd-... [ websrv_poll ] ERR  #ZZ: Error while invoking onFinished client callback: Access to file denied| net/HttpRequest.hpp:1515
wsd-... [ docbroker_XXX ] WRN  getNewChild: No child available... Timed out...

Browser log (Console tab)

[INFO] viewer: Opening viewer for file ...
[getWopiUrl] https://mysite.com/nextcloud/index.php/apps/richdocuments/wopi/files/...
[viewer] Received post message App_LoadingStatus { Status: "Initialized" }
Document loading failed due to timeout: Please check for failing network requests richdocuments-viewer.js:2:1834298 # Or similar line number
    loadingTimeout Office.vue:XXX
    ... (VueJS trace) ...
```*(Add any other red errors seen in the console)*

</details>

**Additional Context:**

*   WebSocket connection (`wss://office.mysite.com/cool/.../ws`) establishes successfully (Status 101).
*   The initial `coolclient ... load url=...` message is sent via WebSocket.
*   The problem seems specific to the internal processing within Collabora *after* receiving a successful `CheckFileInfo` response, possibly related to accessing `/wopi/settings?type=systemconfig`, resulting in `Access to file denied`.

**Request:**

Could you please investigate why Collabora might encounter an internal "Access to file denied" after a successful `CheckFileInfo`, specifically when processing the response or querying `/wopi/settings?type=systemconfig` in this Apache reverse proxy setup with Nextcloud `31.0.4.1` and Richdocuments `8.6.4`? The configuration seems correct according to documentation and debug logs show necessary headers (`X-Forwarded-Proto`) are received, and the relevant server IP is listed in `post_allow`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginfo neededFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions