Nextcloud Office with Collabora Built-In loads forever and fails (because of CachedRequestService#152?)

Nextcloud version: 29.0.5
Operating system and version : Ubuntu 20.04.6 LTS
Apache or nginx version: Apache/2.4.41
PHP version: 8.3

The issue you are facing:

Is this the first time you’ve seen this error? Yes

Steps to replicate it:

  1. Install Collabora Online - Built-in CODE Server
  2. Install Nextcloud Office
  3. Configure (?) – This is what Nextcloud Office reports about the Built-in Server:
Collabora Online server is reachable.

Collabora Online Development Edition 24.04.5.2 ca2ed20

URL used by the browser: https://nextcloud.EXAMPLE.de
Nextcloud URL used by Collabora: https://nextcloud.EXAMPLE.de (Determined from the browser URL)
  1. I have no WOPI configured, because (sadly) I want it to be accessible for guests. (Which I hate myself, but it’s the requirement for this particular one…)
  2. When trying to access a file, I get a loading spinner that spins forever. The log shows a error message (see below).

The output of your Nextcloud log in Admin > Logging:

 Fetched remote endpoint from capabilities in 0.059 seconds
"Jul 26, 2024, 10:05:45 AM"	
Error	PHP	
Trying to access array offset on null at /var/www/vhosts/EXAMPLE.de/nextcloud.EXAMPLE.de/apps/richdocuments/lib/Service/CachedRequestService.php#152
"Jul 26, 2024, 10:05:44 AM"	
Error	PHP	
Trying to access array offset on null at /var/www/vhosts/EXAMPLE.de/nextcloud.EXAMPLE.de/apps/richdocuments/lib/Service/CachedRequestService.php#151
"Jul 26, 2024, 10:05:44 AM"	
Error	PHP	
Trying to access array offset on null at /var/www/vhosts/EXAMPLE.de/nextcloud.EXAMPLE.de/apps/richdocuments/lib/Service/CachedRequestService.php#150
"Jul 26, 2024, 10:05:44 AM"

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array(
  'instanceid' => 'EXAMPLEINSTANCEID',
  'passwordsalt' => 'EXAMPLESALT',
  'secret' => 'EXAMPLESECRET',
  'trusted_domains' =>
  array(
    0 => 'nextcloud.EXAMPLE.de',
  ),
  'datadirectory' => realpath(__dir__ . '/../data'),
  'overwrite.cli.url' => 'https://nextcloud.EXAMPLE.de',
  'dbtype' => 'mysql',
  'version' => '29.0.4.1',
  'dbname' => 'nextcloud_db',
  'dbhost' => '127.0.0.1',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud_user',
  'dbpassword' => 'EXAMPLEHASHEDPW',
  'installed' => true,
  'mail_from_address' => 'web',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'EXAMPLE.de',
  'mail_smtphost' => 'smtp-mail.outlook.com',
  'mail_smtpport' => '587',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'EXAMPLE@EXAMPLE.de',
  'mail_smtppassword' => 'SUPEREXAMPLEPW',
  'default_phone_region' => 'DE',
  'maintenance_window_start' => 1,
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array(
    'host' => '127.0.0.1',
    'port' => 6379,
  ),
  'loglevel' => 0,
  'default_language' => 'en',
  'force_language' => 'en',
);

The output of your Apache/nginx/system log in /var/log/____:

[Fri Jul 26 10:31:56.000378 2024] [fcgid:warn] [pid 2773984] [client 95.130.163.96:0] mod_fcgid: stderr: PHP Warning:  http_response_code(): Cannot set response code - headers already sent (output started at /var/www/vhosts/EXAMPLE.de/nextcloud.EXAMPLE.de/apps/richdocumentscode/proxy.php on line 292

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

Not quite sure where to find this to be honest. Don’t have those logs on my server, so maybe they’re someplace else – and I don’t know what topright menu this is referring to, I’m not saying anything quite like a log there.

please review Collabora integration guide for better understanding of integration and troubleshooting hints.

likely you mean “Allow list for WOPI requests” - this one doesn’t limit client access it only limits which CODE (WOPI) systems are allowed to access Nextcloud. for me following setting perfectly works and allows external anonymous participants

image

What happens when you visit the following in your browser:

https://nextcloud.EXAMPLE.de/apps/richdocumentscode/proxy.php?status

The error suggests an HTTP 200 response code is coming (expected), but that the status itself is empty/unexpected somehow.

In a fully functioning CODE environment you should see: {"status":"OK"}.

Yep, it basically print out the apache’s error about the headers already being set there, but also the JSON with OK message:

{"status":"OK"}<br />
<b>Warning</b>:  http_response_code(): Cannot set response code - headers already sent (output started at /var/www/vhosts/EXAMPLE.de/nextcloud.EXAMPLE.de/apps/richdocumentscode/proxy.php:285) in <b>/var/www/vhosts/EXAMPLE.de/nextcloud.EXAMPLE.de/apps/richdocumentscode/proxy.php</b> on line <b>292</b><br />

EDIT: Also thanks @wwe, for clearing up my misunderstanding about WOPI. I’ve set it to the server’s IP.

EDIT2: For funsie’s I’ve removed the line in question:

http_response_code(200);

And now it works. Weird. I’m guessing there is some misconfiguration on my end with nginx going on, but that’s just wild guess?

1 Like

Your initial message said Apache. Where is Nginx entering the mix? As your proxy?

Can you clarify?

If you’re using Nginx as your web server (i.e. it has a handler connection directly to php-fpm) then you should be using this config (which is routinely updated): NGINX configuration — Nextcloud latest Administration Manual latest documentation

If you’re using Nginx purely as a proxy in front of your Apache web server, then the proxy config should be very short (not the above). Post it if you like.