Skip to content

App not working with Collabora v25 #4906

@Nirajn2311

Description

@Nirajn2311

Describe the bug
The app is not working with v25 of Collabora and doesn't open any Office files but the same files work with Collabora v24 without any issue due to it trying to fetch a template file(documentView.xcu) with the wrong base url ie. using the actual nextcloud instance url instead of the configured callback url.

Nextcloud(nextcloud.domain.com) and collabora(collabora.domain.com) are both running behind cloudflare tunnels with an authentication page. My setup was working fine with Collabora v24 but when I upgraded it today it started to fail.

To Reproduce
Steps to reproduce the behavior:

  1. Open any Office file with Collabora v25
  2. See collabora logs for error where it's trying to fetch the xcu file with wrong base url

Expected behavior
The file should open as it normally would in Collabora v24

I dug a bit into this issue and I believe the changes introduced in #4373 is causing it by not setting the right base url when sending the JSON response back.

Server details

Operating system: Ubuntu 24.04

Nextcloud version: 31.0.7

Version of the richdocuments app: 8.7.2

Configuration of the richdocuments app

{
    "apps": {
        "richdocuments": {
            "external_apps": "",
            "disable_certificate_verification": "yes",
            "wopi_allowlist": "",
            "wopi_url": "http:\/\/collabora:9980",
            "public_wopi_url": "https:\/\/collabora.domain.com",
            "doc_format": "ooxml",
            "installed_version": "8.7.2",
            "types": "filesystem,prevent_group_restriction",
            "enabled": "yes",
            "wopi_callback_url": "http:\/\/nextcloud-aio-apache:16000"
        }
    }
}
Relevant Collabora Logs

I've left my comments(lines beginning with //) in the logs

// Collabora sending request to richdocuments app(for WOPI settings I believe). Note the request is using the above wopi callback url
collabora  | wsd-00001-00031 2025-07-26 10:48:06.975750 +0000 [ websrv_poll ] DBG  Getting settings from [http://nextcloud-aio-apache:16000/index.php/apps/richdocuments/wopi/settings?type=systemconfig&access_token=q9V4U5l9hEn1BDXAjU01GVIGvhcjhEn8&fileId=-1]| wsd/DocumentBroker.cpp:1878
collabora  | wsd-00001-00031 2025-07-26 10:48:06.975767 +0000 [ websrv_poll ] DBG  Connecting to nextcloud-aio-apache:16000 (Unencrypted)| net/NetUtil.cpp:457
collabora  | wsd-00001-00031 2025-07-26 10:48:06.975776 +0000 [ websrv_poll ] DBG  #-1: Starting asyncRequest on [websrv_poll]: GET nextcloud-aio-apache:16000 /index.php/apps/richdocuments/wopi/settings?type=systemconfig&access_token=q9V4U5l9hEn1BDXAjU01GVIGvhcjhEn8&fileId=-1| net/HttpRequest.hpp:1461
collabora  | wsd-00001-00031 2025-07-26 10:48:06.975782 +0000 [ websrv_poll ] DBG  #-1: WOPI::CheckFileInfo succeeded but we don't have the client's WebSocket yet. Deferring the ClientSession creation.| wsd/RequestVettingStation.cpp:373
collabora  | wsd-00001-00020 2025-07-26 10:48:06.809196 +0000 [ asyncdns ] DBG  #40 New socket connected to nextcloud-aio-apache:16000 (Unencrypted)| net/NetUtil.cpp:516
collabora  | wsd-00001-00020 2025-07-26 10:48:06.809205 +0000 [ asyncdns ] DBG  SocketPoll [websrv_poll] thread is already running.| net/Socket.cpp:425
collabora  | wsd-00001-00020 2025-07-26 10:48:06.976070 +0000 [ asyncdns ] DBG  #40: Created socket. Thread affinity set to 0x73f02c8786c0, Socket[#40, IPv4 @ :0]| net/Socket.hpp:472
collabora  | wsd-00001-00020 2025-07-26 10:48:06.976080 +0000 [ asyncdns ] DBG  #40 New socket connected to nextcloud-aio-apache:16000 (Unencrypted)| net/NetUtil.cpp:516
collabora  | wsd-00001-00031 2025-07-26 10:48:06.975820 +0000 [ websrv_poll ] DBG  #40: Closed socket Socket[#40, IPv4 @ :0]| net/Socket.hpp:503
// Richdocuments sends response back to Collabora with wrong base URL for the "uri" property. It's using the public url instead of the wopi callback url I've configured
collabora  | wsd-00001-00031 2025-07-26 10:48:07.097566 +0000 [ websrv_poll ] DBG  Presets JSON for [http://nextcloud-aio-apache:16000/index.php/apps/richdocuments/wopi/settings?type=systemconfig&access_token=q9V4U5l9hEn1BDXAjU01GVIGvhcjhEn8&fileId=-1] is: {"kind":"shared","xcu":[{"stamp":"ac7434314b7177f3baa389a7dfd95ea8","uri":"https:\/\/nextcloud.domain.com\/apps\/richdocuments\/settings\/systemconfig\/Vx1zimTWczYpvkbay0zmVVP93EbvUekP\/xcu\/documentView.xcu"}],"template":[]}| wsd/DocumentBroker.cpp:1913
collabora  | wsd-00001-00031 2025-07-26 10:48:07.180793 +0000 [ websrv_poll ] DBG  cacheFile: /opt/cool/cache/shared-http_nextcloud-aio-apache%3A16000%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Fsettings-6884ab7b45c06687bda527b8fa/https%3A%2F%2Fnextcloud.domain.com%2Fapps%2Frichdocuments%2Fsettings%2Fsystemconfig%2FVx1zimTWczYpvkbay0zmVVP93EbvUekP%2Fxcu%2FdocumentView.xcu/contents cache miss.| wsd/CacheUtil.cpp:110
collabora  | wsd-00001-00031 2025-07-26 10:48:07.181080 +0000 [ websrv_poll ] INF  cacheFile: removing stale cache dir: /opt/cool/cache/shared-http_nextcloud-aio-apache%3A16000%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Fsettings-6884ab7b45c06687bda527b8fa/| wsd/CacheUtil.cpp:207
collabora  | wsd-00001-00031 2025-07-26 10:48:07.181116 +0000 [ websrv_poll ] DBG  Removing [/opt/cool/cache/shared-http_nextcloud-aio-apache%3A16000%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Fsettings-6884ab7b45c06687bda527b8fa/] recursively.| common/FileUtil-unix.cpp:116
collabora  | wsd-00001-00031 2025-07-26 10:48:07.181371 +0000 [ websrv_poll ] INF  Async fetch of presets for shared-http_nextcloud-aio-apache:16000/index.php/apps/richdocuments/wopi/settings-6884ab7b45c06687bda527b8fa launched| wsd/DocumentBroker.cpp:1673
// Collabora tries to fetch the XCU file
collabora  | wsd-00001-00031 2025-07-26 10:48:07.181409 +0000 [ websrv_poll ] DBG  Getting preset from [https://nextcloud.domain.com/apps/richdocuments/settings/systemconfig/Vx1zimTWczYpvkbay0zmVVP93EbvUekP/xcu/documentView.xcu]| wsd/DocumentBroker.cpp:1941
collabora  | wsd-00001-00031 2025-07-26 10:48:07.181498 +0000 [ websrv_poll ] DBG  Connecting to nextcloud.domain.com:443 (SSL)| net/NetUtil.cpp:457
collabora  | wsd-00001-00031 2025-07-26 10:48:07.181537 +0000 [ websrv_poll ] DBG  #-1: Starting asyncRequest on [websrv_poll]: GET nextcloud.domain.com:443 /apps/richdocuments/settings/systemconfig/Vx1zimTWczYpvkbay0zmVVP93EbvUekP/xcu/documentView.xcu| net/HttpRequest.hpp:1461
collabora  | wsd-00001-00031 2025-07-26 10:48:07.181559 +0000 [ websrv_poll ] DBG  Saving preset file to jailPath[/opt/cool/child-roots/1-4bc54e0f/tmp/sharedpresets/shared-http_nextcloud-aio-apache%3A16000%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Fsettings-6884ab7b45c06687bda527b8fa/xcu/config.xcu]| wsd/DocumentBroker.cpp:2001
collabora  | wsd-00001-00020 2025-07-26 10:48:06.976087 +0000 [ asyncdns ] DBG  SocketPoll [websrv_poll] thread is already running.| net/Socket.cpp:425
collabora  | wsd-00001-00020 2025-07-26 10:48:07.185183 +0000 [ asyncdns ] DBG  #40: Created socket. Thread affinity set to 0x73f02c8786c0, Socket[#40, IPv4 @ :0]| net/Socket.hpp:472
collabora  | wsd-00001-00020 2025-07-26 10:48:07.188057 +0000 [ asyncdns ] DBG  #40 New socket connected to nextcloud.domain.com:443 (SSL)| net/NetUtil.cpp:516
collabora  | wsd-00001-00020 2025-07-26 10:48:07.188094 +0000 [ asyncdns ] DBG  SocketPoll [websrv_poll] thread is already running.| net/Socket.cpp:425
collabora  | wsd-00001-00031 2025-07-26 10:48:07.181996 +0000 [ websrv_poll ] DBG  #40: Closed socket Socket[#40, IPv4 @ :0]| net/Socket.hpp:503
collabora  | wsd-00001-00031 2025-07-26 10:48:07.189411 +0000 [ websrv_poll ] DBG  #40: SSL error (handshake): WANT_READ (2), rc: -1, errno: 11 (EAGAIN: Resource temporarily unavailable): BIO error: 0: error:00000000:lib(0)::reason(0):| net/SslSocket.hpp:387
collabora  | wsd-00001-00031 2025-07-26 10:48:07.189486 +0000 [ websrv_poll ] DBG  #40: SSL error (handshake): WANT_READ (2), rc: -1, errno: 11 (EAGAIN: Resource temporarily unavailable): BIO error: 0: error:00000000:lib(0)::reason(0):| net/SslSocket.hpp:387
collabora  | wsd-00001-00031 2025-07-26 10:48:07.200231 +0000 [ websrv_poll ] DBG  #40: SSL error (handshake): WANT_READ (2), rc: -1, errno: 11 (EAGAIN: Resource temporarily unavailable): BIO error: 0: error:00000000:lib(0)::reason(0):| net/SslSocket.hpp:387
collabora  | wsd-00001-00031 2025-07-26 10:48:07.209838 +0000 [ websrv_poll ] DBG  #40: SSL error (read): WANT_READ (2), rc: -1, errno: 11 (EAGAIN: Resource temporarily unavailable): BIO error: 0: error:00000000:lib(0)::reason(0):| net/SslSocket.hpp:387
// Collabora fails to fetch the XCU file because the request gets redirected to cloudflares login page
collabora  | wsd-00001-00031 2025-07-26 10:48:07.229465 +0000 [ websrv_poll ] ERR  Failed to fetch preset uri[https://nextcloud.domain.com/apps/richdocuments/settings/systemconfig/Vx1zimTWczYpvkbay0zmVVP93EbvUekP/xcu/documentView.xcu] with status[Moved Temporarily]| wsd/DocumentBroker.cpp:1965
collabora  | wsd-00001-00031 2025-07-26 10:48:07.229475 +0000 [ websrv_poll ] DBG  Removing [/opt/cool/child-roots/1-4bc54e0f/tmp/sharedpresets/shared-http_nextcloud-aio-apache%3A16000%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Fsettings-6884ab7b45c06687bda527b8fa/xcu/config.xcu] only.| common/FileUtil-unix.cpp:116
collabora  | wsd-00001-00031 2025-07-26 10:48:07.229532 +0000 [ websrv_poll ] INF  Async fetch of presets for shared-http_nextcloud-aio-apache:16000/index.php/apps/richdocuments/wopi/settings-6884ab7b45c06687bda527b8fa completed. Success: false| wsd/DocumentBroker.cpp:1592
collabora  | wsd-00001-00031 2025-07-26 10:48:07.229537 +0000 [ websrv_poll ] ERR  #-1: Failed to install config [shared-http_nextcloud-aio-apache:16000/index.php/apps/richdocuments/wopi/settings-6884ab7b45c06687bda527b8fa]| wsd/RequestVettingStation.cpp:195

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions