Wrong public WOPI url when collabora runs with non-empty net.service_root
Describe the bug
Our organisations only allows traffic through one webproxy domain to reach the containers such as nextcloud and collabora.
Hence, we have the two containers exposed like this:
- https://inbound-gate.com/department/nextcloud
- https://inbound-gate.com/department/collabora
On top, the k8s cluster sets up an internal network, so that the containers can talk directly to each other.
Collabora container has set:
extra_params: --o:ssl.enable=false --o:ssl.termination=true --o:ssl.ssl_verification=false --o:fetch_update_check=0 --o:user_interface.mode=tabbed --o:remote_font_config.url=[…]/fonts.json --o:net.proto=IPv4 --o:net.service_root=/department/collabora
server_name: inbound-gate.com:443
To Reproduce
php occ richdocuments:setup --wopi-url http://$COLLABORA_SERVICE_HOST:$COLLABORA_SERVICE_PORT/edps/collabora --callback-url http://$NEXTCLOUD_SERVICE_HOST:$NEXTCLOUD_SERVICE_PORT/edps/cloud
php occ config:list richdocuments
Notice that the public_wopi_url is https://inbound-gate.com instead of https://inbound-gate.com/department/collabora
Expected behavior
The public_wopi_url is https://inbound-gate.com/department/collabora
Version of the richdocuments app
8.5.6
Version of Collabora Online
24.04.9.1
How to fix this
I believe the problem comes from here:
https://github.com/nextcloud/richdocuments/blob/3dbbe03d4e6a5cf5b0dacc584b3ce47973ab28c8/lib/Service/ConnectivityService.php#L58-L61
Excerpt:
$determinedUrl = $this->parser->getUrlSrcValue('application/vnd.openxmlformats-officedocument.wordprocessingml.document');
$detectedUrl = $this->appConfig->domainOnly($determinedUrl);
$this->appConfig->setAppValue('public_wopi_url', $detectedUrl);
Instead of extracting domainOnly, also the path needs to be extracted.