When running Nextcloud Office with the built-in Collabora CODE Server, documents may fail to open even though the Collabora configuration check looks fine.
In our case, the issue appeared after running Nextcloud 3x.x with Nginx, PHP-FPM and HTTP/3 enabled.
The browser showed:
Document loading failed due to timeout
The network tab showed a failing Collabora request:
/apps/richdocumentscode/proxy.php?req=/browser/.../cool.html?... 400
And the Nginx error log contained:
PHP Warning: Undefined array key "HTTP_HOST" in /var/www/nextcloud/apps/richdocumentscode/proxy.php on line 340
The important part: the request was handled via HTTP/3:
request: "POST /apps/richdocumentscode/proxy.php?... HTTP/3.0"
Environment
Example setup:
Nextcloud: 33.0.3
Nextcloud Office / richdocuments: 10.1.3
Built-in CODE Server / richdocumentscode: 25.4.904
Webserver: Nginx
PHP-FPM: PHP 8.3
HTTP/2: enabled
HTTP/3: enabled
The Nextcloud Office configuration itself looked valid:
sudo -u www-data php /var/www/nextcloud/occ richdocuments:activate-config
Output:
✓ Fetched /hosting/discovery endpoint
✓ Valid mimetype response
✓ Valid capabilities entry
✓ Fetched /hosting/capabilities endpoint
✓ Detected WOPI server: Collabora Online Development Edition
So the built-in Collabora server was reachable. The problem was not Collabora itself.
Cause
The issue was caused by the Nginx FastCGI configuration in combination with HTTP/3.
The built-in Collabora CODE Server is accessed through:
/apps/richdocumentscode/proxy.php
This PHP proxy expects the following PHP server value:
$_SERVER['HTTP_HOST']
With HTTP/3, the host information is not always passed to PHP-FPM in the classic way. Technically, HTTP/3 uses :authority instead of the traditional HTTP/1.1 Host header.
If Nginx does not explicitly pass a valid host value into FastCGI, PHP may not receive HTTP_HOST. Collabora then fails with HTTP 400 or a document loading timeout.
Fix
Add explicit FastCGI parameters to the PHP location block in your Nginx configuration.
Example:
location ~ \.php(?:$|/) {
rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|ocs-provider\/.+|.+/richdocumentscode/proxy) /index.php$request_uri;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
set $path_info $fastcgi_path_info;
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
# Important for Nextcloud Office / Collabora / HTTP3
fastcgi_param HTTP_HOST $host;
fastcgi_param SERVER_NAME $host;
fastcgi_param HTTPS on;
fastcgi_param REQUEST_SCHEME https;
fastcgi_param HTTP_X_FORWARDED_PROTO https;
fastcgi_param HTTP_X_FORWARDED_HOST $host;
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
fastcgi_read_timeout 3600;
fastcgi_connect_timeout 3600;
fastcgi_send_timeout 3600;
fastcgi_max_temp_file_size 0;
}
The most important line is:
fastcgi_param HTTP_HOST $host;
Place it after include fastcgi_params;, so it overrides missing or empty default values.
Reload Nginx and PHP-FPM
After editing the config, test and reload Nginx:
sudo nginx -t
sudo systemctl reload nginx
Then reload PHP-FPM:
sudo systemctl reload php8.3-fpm
Adjust the PHP version if required:
sudo systemctl reload php8.2-fpm
or:
sudo systemctl reload php8.4-fpm
Verify the Collabora configuration
Run:
sudo -u www-data php /var/www/nextcloud/occ richdocuments:activate-config
Or with an explicit PHP version:
sudo -u www-data php8.3 /var/www/nextcloud/occ richdocuments:activate-config
Expected result:
✓ Fetched /hosting/discovery endpoint
✓ Valid mimetype response
✓ Valid capabilities entry
✓ Fetched /hosting/capabilities endpoint
✓ Detected WOPI server: Collabora Online Development Edition
Then hard-refresh Nextcloud in the browser:
Cmd + Shift + R
or use the browser developer tools:
Network → Disable cache → Reload
Optional test: Disable HTTP/3 temporarily
If the issue still appears, disable HTTP/3 temporarily to confirm the cause.
Comment out lines like these:
# listen 443 quic reuseport;
# listen [::]:443 quic reuseport;
# http3 on;
# add_header Alt-Svc 'h3=":443"; ma=86400, h3-29=":443"; ma=86400' always;
Then reload Nginx:
sudo nginx -t
sudo systemctl reload nginx
If Nextcloud Office starts working immediately after disabling HTTP/3, the issue is very likely related to HTTP/3 and FastCGI header forwarding.
Related browser console messages
You may also see warnings like:
Refused to apply style ... because its MIME type ('text/html') is not a supported stylesheet MIME type
or:
viewer: Some mimes were ignored because they are not enabled in the server previews config
These messages are not always the root cause of the Collabora timeout. In this case, the decisive error was the missing HTTP_HOST value in the PHP-FPM context.
Quick Summary
If Nextcloud Office / Collabora fails with proxy.php, HTTP 400 or document loading timeouts, check your Nginx error log.
If you see:
Undefined array key "HTTP_HOST" in richdocumentscode/proxy.php
add the following lines to your PHP FastCGI block:
fastcgi_param HTTP_HOST $host;
fastcgi_param SERVER_NAME $host;
fastcgi_param HTTPS on;
fastcgi_param REQUEST_SCHEME https;
fastcgi_param HTTP_X_FORWARDED_PROTO https;
fastcgi_param HTTP_X_FORWARDED_HOST $host;
Then reload Nginx and PHP-FPM.