Opening Documents returns an empty screen and a HTTP 400 error
The server is running Nextcloud 20.0.8 on Debian 10 and Apache as webserver. Now I've tried to get the built-in CODE-Sever and Collabora Online from the app store running at it failed.
Everything is the latest version from the official repositries in case of the Debian. The version of CODE is 6.4.607 and Collabora Online is 3.7.15 both from Nextcloud's app store.
The Nextcloud installation is completely in a tradional way. No Docker involved.
Looking at the setup page of Collabora Online it tells me that the built-in CODE app is reachable.
Now when I try to open a document I only get the menu with File and so on on the top and the rest of the screen remains empty. I doesn't matter if I try it using Firefox or Safari on my Mac.
Looking at the browser console of my Firefox I can see a HTTP 400 error when the file should be loaded. I can also see this error in the log of the Apache.
However when I switch from the internal CODE to a demo server in Collabora Online opening a file works fine.
The developer of the richdocuments app says here that it's a problem of richdocumentscode.
Yes, Built-in CODE server returns HTTP error 400 when something is wrong. From apache error log maybe you can find the reason.
I just updated everything again to the lastest versions for another test and now it works.
Yesterday I've finally noticed the pattern for this. After my last post I had to restart the Apache due to a configuration change. Afterwards CODE worked. Now yesterday there was a kernel update for Debian. Rebooted the machine and there was the HTTP error 400 again. Restarted the Apache by systemctl restart like I did after the config change. And CODE was working again. Made another reboot out of curiosity. HTTP 400 again for CODE. Restarted the Apache and CODE worked again.
The error log of the Apache stays clean.
Update: I have just tried something more. When you try to open a document for the first time after a reboot and get the HTTP 400 you can afterwards see a CODE running under PHP-FPM in the systemctl status tree. Yet restarting the Apache demon does the trick for making CODE work.
I actually found a solution to this by accident on Nextcloud's forum after doing a clean install of everything for using Debian 11 as my server's OS. After the install the same problem was still there.
- My webserver running my Nextcloud and Built-in CODE is in an internal 192.168.X.X network behind my router
- My public DNS entry for nextcloud.foo.bar and IPv4 points to my router's public IPv4.
- The traffic is port-forwarded from my router
And this seems to be a problem for the Built-in CODE.
Adding an entry to the hosts file of my webserver that makes the domain nextcloud.foo.bar point to 127.0.1.1 makes everthing work nicely.
This should be added to the documentation since probably other people with similar setups are experiencing the similar problems.