nextcloud / nextcloud/richdocuments

Wrong public WOPI url when collabora runs with non-empty net.service_root

Open
#4,696 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug feature: settings setup
Dominant language
JavaScript
Stars
453
Forks
147
Avg merge
14h 54m
Merged PRs (30d)
83

Description

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:

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/Service/ConnectivityService.php at the shown public_wopi_url assignment and inspect how the parser result is reduced to a domain. Reproduce the setup with the provided php occ commands, then verify that the stored public_wopi_url preserves /department/collabora instead of only https://inbound-gate.com.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.