Skip to content

feat: Add setup checks and verify WOPI connectivity - #4470

Merged
juliusknorr merged 4 commits into
mainfrom
feat/setup-check
Oct 15, 2026
Merged

juliusknorr merged 4 commits into
mainfrom
feat/setup-check

Conversation

@juliusknorr

@juliusknorr juliusknorr commented Feb 13, 2025 •

Copy link
Copy Markdown
Member
  • Add a setup check to verify that we are running the latest Collabora release
  • Add a setup check to verify connectivity with the collabora server
  • Extend the connectivity checks with using the new Collabora endpoint to verify WOPI access (that Collabora can reach Nextcloud)

Fixes #4267

Needs CollaboraOnline/online#11162 for self-signed certificates that are not trusted on Collabora (without validation)

Screenshot 2025-02-13 at 23 03 14 Screenshot 2025-02-13 at 23 26 25

Comment thread lib/Service/ConnectivityService.php Outdated
@juliusknorr juliusknorr added 3. to review Ready to be reviewed enhancement New feature or request labels Feb 13, 2025
@juliusknorr
juliusknorr marked this pull request as ready for review February 13, 2025 22:27
@juliusknorr
juliusknorr requested a review from a team February 13, 2025 22:28
@juliusknorr

This comment was marked as resolved.

@blizzz

This comment was marked as resolved.

@juliusknorr

This comment was marked as outdated.

@juliusknorr juliusknorr mentioned this pull request Feb 25, 2025
1 of 4 tasks
@juliusknorr
juliusknorr force-pushed the feat/setup-check branch 4 times, most recently from 8988183 to 4097090 Compare March 18, 2025 20:15
Comment thread lib/Service/ConnectivityService.php
@juliusknorr
juliusknorr force-pushed the feat/setup-check branch 2 times, most recently from c3739fa to 6f60946 Compare March 20, 2025 11:21
@juliusknorr

Copy link
Copy Markdown
Member Author

@meven I'm struggling to get CI passing as when the check runs Collabora returns an UnspecifiedError, however the status code is a 200 as far as I see in the logs.

Do you have any clue why that is not passing?

wsd-00001-00032 2025-03-20 21:32:08.932036 +0000 [ websrv_poll ] DBG  #30: Handling request: /hosting/wopiAccessCheck, closeConnection false| wsd/ClientRequestDispatcher.cpp:700
  wsd-00001-00032 2025-03-20 21:32:08.932046 +0000 [ websrv_poll ] DBG  #30: Wopi Access Check request: /hosting/wopiAccessCheck| wsd/ClientRequestDispatcher.cpp:1140
  wsd-00001-00032 2025-03-20 21:32:08.932087 +0000 [ websrv_poll ] DBG  Connecting to 172.17.0.1:8081 (Unencrypted)| net/NetUtil.cpp:458
  wsd-00001-00032 2025-03-20 21:32:08.932105 +0000 [ websrv_poll ] DBG  #-1: starting asyncRequest: GET 172.17.0.1:8081 /status.php| net/HttpRequest.hpp:1340
  wsd-00001-00032 2025-03-20 21:32:08.932112 +0000 [ websrv_poll ] DBG  #30: Handled request: /hosting/wopiAccessCheck, inBuf[sz 231 -> 54, rm 177], connection open true| wsd/ClientRequestDispatcher.cpp:994
  wsd-00001-00022 2025-03-20 21:32:08.932537 +0000 [ asyncdns ] DBG  #31: Created socket. Thread affinity set to 0x7fd3450006c0, Socket[#31, IPv4 @ :0]| net/Socket.hpp:474
  wsd-00001-00022 2025-03-20 21:32:08.932558 +0000 [ asyncdns ] DBG  #31 New socket connected to 172.17.0.1:8081 (Unencrypted)| net/NetUtil.cpp:517
  wsd-00001-00032 2025-03-20 21:32:09.116401 +0000 [ websrv_poll ] DBG  #31: Closed after reading. Read result: 0 errno: 0| net/Socket.hpp:1515
  wsd-00001-00032 2025-03-20 21:32:09.116470 +0000 [ websrv_poll ] DBG  #30: Wopi Access Check: got response state: State::Error , response status code: 200 (OK) , last errno: 0| wsd/ClientRequestDispatcher.cpp:1316
  wsd-00001-00032 2025-03-20 21:32:09.116522 +0000 [ websrv_poll ] INF  #30: Wopi Access Check request, result: UnspecifiedError| wsd/ClientRequestDispatcher.cpp:1226
  wsd-00001-00032 2025-03-20 21:32:09.116552 +0000 [ websrv_poll ] DBG  #31: Closed socket Socket[#31, IPv4 @ :0]| net/Socket.hpp:171
  wsd-00001-00032 2025-03-20 21:32:09.116588 +0000 [ websrv_poll ] DBG  #30: Closed socket Socket[#30, IPv6 @ ::ffff:172.18.0.1:64643]| net/Socket.hpp:171

@juliusknorr

Copy link
Copy Markdown
Member Author

@meven Any further hint? Would be great to get this in

@meven

meven commented Apr 30, 2025

Copy link
Copy Markdown
Contributor

@meven Any further hint? Would be great to get this in

Thank you for the ping, was really busy back in March.

  wsd-00001-00032 2025-03-20 21:32:09.116470 +0000 [ websrv_poll ] DBG  #30: Wopi Access Check: got response state: State::Error , response status code: 200 (OK) , last errno: 0| wsd/ClientRequestDispatcher.cpp:1316

Points toward an explicit error contacting the wopi/nextcloud host.
The error could be improved, the fact the response Status code is 200 might point toward a bug.

This might be a bug in the insecure/HTTP code path.

Looking

@meven

meven commented May 13, 2025

Copy link
Copy Markdown
Contributor

I haven't managed to find the origin.
With 25.04, code has changed, would be curious to know if that changes something.
A bit busy ATM, will be back on it.

@juliusknorr

Copy link
Copy Markdown
Member Author

I'll do a rebase to see if the nightly code build now behaves different (that is one built from online master branch)

@meven

meven commented Jun 4, 2025

Copy link
Copy Markdown
Contributor

It seems like your callballUrl request's response was empty and wasn't in one of the three case:

Consequently our http client considered this answer erroneous, as it prematurely disconnected.

(A 200 with no Content-Length, must have some content, as 204 is to be used when no Content is needed).

A curl -v request to your callback to your endpoint should reveal it.

Thanks @Ashod for helping on this.

@juliusknorr

Copy link
Copy Markdown
Member Author

Thanks that is very helpful, let me push a step in CI run run that curl.

Content-Length missing rings a bell (https://cweiske.de/tagebuch/content-length-header-missing.htm) and locally i do see it sent back as a response header.

@juliusknorr

Copy link
Copy Markdown
Member Author

Yes, it seems that when running the tests with the built-in webserver in CI we have a content but no content length.

I'm not sure that is expected as the response header should be optional even if we have some body.

I'll test if the tests pass if i switch to an empty response with 204 instead

 [4351] [Wed Jun  4 16:23:54 2025] [::1]:38488 [200]: GET /status.php
< HTTP/1.1 200 OK
< Host: localhost:8081
< Date: Wed, 04 Jun 2025 16:23:54 GMT
< Connection: close
< X-Powered-By: PHP/8.1.32
< Content-Security-Policy:default-src 'self'; script-src 'self' 'nonce-9WBcjYjKqk8FWft6yHCr/3ufHhm2GuyxynXmlilspWA='; style-src 'self' 'unsafe-inline'; frame-src *; img-src * data: blob:; font-src 'self' data:; media-src *; connect-src *; object-src 'none'; base-uri 'self';
< Referrer-Policy: no-referrer
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< X-Permitted-Cross-Domain-Policies: none
< X-Robots-Tag: noindex, nofollow
< X-XSS-Protection: 1; mode=block
< Set-Cookie: nc_sameSiteCookielax=true; path=/; httponly;expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax
< Set-Cookie: nc_sameSiteCookiestrict=true; path=/; httponly;expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=strict
< Access-Control-Allow-Origin: *
< Content-Type: application/json

@Ashod

@juliusknorr

Copy link
Copy Markdown
Member Author

For the integration test that was the case. The interesting failure is in the cypress ones:

https://github.com/nextcloud/richdocuments/actions/runs/18386970434/job/52387705950?pr=4470

Checking configuration
🛈 Configured WOPI URL: http://localhost:9980
🛈 Configured public WOPI URL: http://localhost:9980
🛈 Configured callback URL: http://172.17.0.1:8081/

✓ Fetched /hosting/discovery endpoint
✓ Valid mimetype response
✓ Valid capabilities entry
✓ Fetched /hosting/capabilities endpoint
✓ Detected WOPI server: Collabora Online Development Edition 25.04.7.0
[5002] [Thu Oct  9 19:33:37 2025] 172.18.0.2:35734 Accepted
[5002] [Thu Oct  9 19:33:37 2025] 172.18.0.2:35734 [200]: GET /status.php
[5002] [Thu Oct  9 19:33:37 2025] 172.18.0.2:35734 Closing
Failed to verify WOPI connectivity
The Collabora server could not properly reach the Nextcloud server at http://172.17.0.1:8081/ Unknown error "UnspecifiedError". Check the server logs of Collabora for more details.

You can also find the Collabora logs there if you unfold the stop container step:
Screenshot 2025-10-16 at 08 37 05

@meven

meven commented Oct 22, 2025 •

Copy link
Copy Markdown
Contributor

For the integration test that was the case. The interesting failure is in the cypress ones:

https://github.com/nextcloud/richdocuments/actions/runs/18386970434/job/52387705950?pr=4470

Checking configuration
🛈 Configured WOPI URL: http://localhost:9980
🛈 Configured public WOPI URL: http://localhost:9980
🛈 Configured callback URL: http://172.17.0.1:8081/

✓ Fetched /hosting/discovery endpoint
✓ Valid mimetype response
✓ Valid capabilities entry
✓ Fetched /hosting/capabilities endpoint
✓ Detected WOPI server: Collabora Online Development Edition 25.04.7.0
[5002] [Thu Oct  9 19:33:37 2025] 172.18.0.2:35734 Accepted
[5002] [Thu Oct  9 19:33:37 2025] 172.18.0.2:35734 [200]: GET /status.php
[5002] [Thu Oct  9 19:33:37 2025] 172.18.0.2:35734 Closing
Failed to verify WOPI connectivity
The Collabora server could not properly reach the Nextcloud server at http://172.17.0.1:8081/ Unknown error "UnspecifiedError". Check the server logs of Collabora for more details.

You can also find the Collabora logs there if you unfold the stop container step: Screenshot 2025-10-16 at 08 37 05

For the integration test that was the case. The interesting failure is in the cypress ones:

https://github.com/nextcloud/richdocuments/actions/runs/18386970434/job/52387705950?pr=4470

Checking configuration
🛈 Configured WOPI URL: http://localhost:9980
🛈 Configured public WOPI URL: http://localhost:9980
🛈 Configured callback URL: http://172.17.0.1:8081/

✓ Fetched /hosting/discovery endpoint
✓ Valid mimetype response
✓ Valid capabilities entry
✓ Fetched /hosting/capabilities endpoint
✓ Detected WOPI server: Collabora Online Development Edition 25.04.7.0
[5002] [Thu Oct  9 19:33:37 2025] 172.18.0.2:35734 Accepted
[5002] [Thu Oct  9 19:33:37 2025] 172.18.0.2:35734 [200]: GET /status.php
[5002] [Thu Oct  9 19:33:37 2025] 172.18.0.2:35734 Closing
Failed to verify WOPI connectivity
The Collabora server could not properly reach the Nextcloud server at http://172.17.0.1:8081/ Unknown error "UnspecifiedError". Check the server logs of Collabora for more details.

You can also find the Collabora logs there if you unfold the stop container step: Screenshot 2025-10-16 at 08 37 05

We can see in the logs that curl -v 172.17.0.1:8081/status.php returns 400 :

* Connected to 172.17.0.1 (172.17.0.1) port 8081
> GET /status.php HTTP/1.1
> Host: 172.17.0.1:8081
> User-Agent: curl/8.5.0
> Accept: */*
> 
[5002] [Thu Oct  9 19:33:34 2025] 10.197.43.98:58716 Accepted
[5002] [Thu Oct  9 19:33:34 2025] 10.197.43.98:58716 [400]: GET /status.php
< HTTP/1.1 400 Bad Request
< Host: 172.17.0.1:8081
< Date: Thu, 09 Oct 2025 19:33:34 GMT
< Connection: close
< X-Powered-By: PHP/8.2.29
< Content-Security-Policy:default-src 'self'; script-src 'self' 'nonce-GwaA7Hz0A+QiPtELP3PbPRvWlUzQ2lo8kPRVuB3chRw='; style-src 'self' 'unsafe-inline'; frame-src *; img-src * data: blob:; font-src 'self' data:; media-src *; connect-src *; object-src 'none'; base-uri 'self';
< Referrer-Policy: no-referrer
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< X-Permitted-Cross-Domain-Policies: none
< X-Robots-Tag: noindex, nofollow
< Set-Cookie: nc_sameSiteCookielax=true; path=/; httponly;expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax
< Set-Cookie: nc_sameSiteCookiestrict=true; path=/; httponly;expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=strict
< Content-Type: application/json

I checked the current wopiAccesCheck should send NotHttpSuccess, but it doesn't, I am checking if there is a bug.

@juliusknorr

Copy link
Copy Markdown
Member Author

Rebased and pushed a quick commit for checking for proof keys.

env:
extra_params: '--o:ssl.enable=false'
aliasgroup1: 'http://nextcloud'
aliasgroup1: 'http://172.17.0.1:8081'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is available in this configuration.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is within the github action setup that the tests run

Comment thread lib/Service/ConnectivityService.php Outdated
$installedVersion = $this->capabilitiesService->getProductVersion();

if ($latestVersion !== null && version_compare($latestVersion, $installedVersion, '>')) {
return SetupResult::warning($this->l10n->t('Collabora server version is out of date. Currently using %s, new version is available: %s', [$installedVersion, $latestVersion]));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@meven meven left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two Minor points, that you can disregard.

From the API usage perspective this is all good, all the enum values are in place with nice text.

I can't vouch as much for the richdocument integration, but nothing looked suspicious.

@juliusknorr
juliusknorr force-pushed the feat/setup-check branch 2 times, most recently from b85ba91 to d255f47 Compare September 29, 2026 14:11
@juliusknorr

Copy link
Copy Markdown
Member Author

Thanks @meven, your theory was right. Pointing the callback at an empty 204 made the UnspecifiedError go away (it then failed with NotHttpSuccess, as expected).

The cause seemed that the php server that is used for testing php -S sending a 200 with a body, Connection: close and no Content-Length, which coolwsd treats as an error even though it's valid HTTP. It reproduces on 25.04.9.4 and 26.04.4.2, so it might be worth fixing on your side.

Otherwise I had now pushed workarounds for this on our end so this is ready to get in

@juliusknorr
juliusknorr requested a review from elzody September 29, 2026 14:31
@juliusknorr

Copy link
Copy Markdown
Member Author

@elzody If you have a second pair of eyes again for this. Would be great to get this in soonish :)

@meven

meven commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

The cause seemed that the php server that is used for testing php -S sending a 200 with a body, Connection: close and no Content-Length, which coolwsd treats as an error even though it's valid HTTP

This should use HTTP header 204 or have a Content-Length: 0.
That's a somewhat strict implementation on our side, by our internal http client.

#4470 (comment)

@juliusknorr

juliusknorr commented Sep 30, 2026 •

Copy link
Copy Markdown
Member Author

Ah then I missed that piece, now we have an OK and content-length as dedicated check endpoint on our end so all fine 👍

Thanks a lot for the assistance and review 🤝

Comment thread lib/SetupCheck/CollaboraUpdate.php Outdated
Comment thread lib/Service/ConnectivityService.php
Comment thread lib/Service/ConnectivityService.php Outdated
@juliusknorr

Copy link
Copy Markdown
Member Author

CI should be covered with #6186

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Julius Knorr <jus@bitgrid.net>
Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Julius Knorr <jus@bitgrid.net>
- Keep cached discovery and capabilities when a connectivity check fails
- Skip the connectivity check when Collabora is not configured
- Respect has_internet_connection and handle failures in the update check
- Handle server errors and invalid responses from wopiAccessCheck
- Pin gh-docker-logs action

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Julius Knorr <jus@bitgrid.net>
- Cache the latest Collabora version for 6 hours
- Reset in-memory capabilities after fetching them
- Drop debug logging from cypress Collabora container

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Julius Knorr <jus@bitgrid.net>
@juliusknorr
juliusknorr merged commit 08ecc95 into main Oct 15, 2026
57 of 58 checks passed
@juliusknorr
juliusknorr deleted the feat/setup-check branch October 15, 2026 09:51
@meven

meven commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Thanks @juliusknorr for reviving this !

Less troubleshooting for Nextcloud Office users !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Ready to be reviewed enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collabora updates are undetected

4 participants