Problem statement
“Nextcloud Office” with “Collabora Online - Built-in CODE Server” do not work for me: when I open a document, I get a blank page, the document never comes up.
Following the Nextcloud Collabora integration guide, I realized that the public hostname shown in hosting/discovery
is wrong: effectively, the domain name is missing:
As you can see in the address bar in the image above, my Nextcloud installation is served under https://nc.bayz.de/nc
. Note the directory in addition to the hostname: /nc
.
But if you look at the links provided in the wopi-discovery, the hostname is missing in the output! How can I fix this?
Debugging
When I try to open a document, the browser console reports problems because it tries to open a page without the hostname:
Content Security Policy: The page’s settings blocked the loading of a resource at http://nc/custom_apps/richdocumentscode/proxy.php?status (“connect-src”). core-common.js:2:10473582
(Firefox shown, but Chrome has same troubles).
However, the installation is reported as alright in the admin settings:
Looking at the guide, I tried to set the wopi_url
- but I failed. Whatever I input as CODE_URL
, the following activate_config
always failed:
- setting
CODE_URL
tohttps://nc.bayz.de
led to:Client error: GET https://nc.bayz.de/hosting/discovery resulted in a 404 Not Found response
- setting
CODE_URL
tohttps://nc.bayz.de/nc/
led to:Client error: GET https://nc.bayz.de/nc/hosting/discovery resulted in a 404 Not Found response:
- setting
CODE_URL
tohttps://nc.bayz.de/nc/custom_apps/richdocumentscode/proxy.php?req=
led to:Client error: GET https://nc.bayz.de/nc/nc/custom_apps/richdocumentscode/proxy.php?req=/hosting/discovery resulted in a 404 Not Found response:
( NOTE: doubled/nc
here, where is this coming from ?!) - setting
CODE_URL
tohttps://nc.bayz.de/custom_apps/richdocumentscode/proxy.php?req=
in an attempt to avoide the somehow appearing doubled/nc
led to:Client error: GET https://nc.bayz.de/nc/nc/custom_apps/richdocumentscode/proxy.php?req=/hosting/discovery resulted in a 404 Not Found response:
- so no success there.
I am not sure where the doubled /nc/nc
is coming from in the third step above. Not sure if this has anything to do with all this.
Background information
- Nextcloud version: 26.0.1, though never worked before in earlier versions
- Nextcloud installation: official docker image
nextcloud:apache
- Collabora Online - Built-in CODE Server: 22.5.1301
- Nextcloud Office: 8.0.1
- Browsers: tested with Firefox 112, Chrome 112
- nginx reverse proxy: nginx version: nginx/1.20.2 (see below)
The probably most “untypical” part of my setup is the reverse proxy: I use nginx as a reverse proxy, which serves Nextcloud under the location /nc
. The proxy configuration is:
location /nc/ {
add_header Front-End-Https on;
proxy_buffering off;
fastcgi_request_buffering off;
proxy_pass http://nc/;
client_max_body_size 0;
}
location = / {
return 301 https://nc.bayz.de/nc;
}
For those interested, this is because Nextcloud is launched as part of a mailu installation.
In case it is interesting, the rewrite configuration in config.php
is:
# grep -iR overwrite config.php
'overwrite.cli.url' => 'https://nc.bayz.de/nc',
'overwritewebroot' => '/nc',
'overwritehost' => 'nc.bayz.de',
'overwriteprotocol' => 'https',
'app_install_overwrite' =>
My question
I assume that the built-in server somehow is not informed about the right public hostname. Thus, links created by it (and sent to the browser) are missing it, are thus wrong, and nothing can work.
Hence I wonder if I can somehow force the public hostname onto the built-in server, to fix this. Is this possible?