richdocumentscode
richdocumentscode copied to clipboard
Not working with subdir and reverse proxy
Hi,
I am using the Collabora online CODE server installed over nextcloud on arm64.
The nextcloud is hosted on apache2 and accessible over a subdir like mydoman.tld/nc through a nginx reverse proxy.
Accessing the nextcloud and all other apps is no problem, but collabora code just wont load correctly, because it tries to access the proxy.php file the second and next requests over domain.tld/apps/... instead of domain.tld/nc/apps/...
If I run: php occ config:app:get richdocuments wopi_url
it gives me the correct url with the subfolder.
It looks like this when trying to access the example file (https://domain.tld/nc/apps/richdocumentscode_arm64/proxy.php?req=/loleaflet/dist/loleaflet.html?file_path=file:///opt/libreoffice/online/test/data/hello-world.odt):
The nextcloud is configured in config/config.php for the proxy and subpath:
[...]
'overwriteprotocol' => 'https',
'overwritehost' => 'domain.tld:443',
'overwritewebroot' => '/nc',
Also nc reports, that collabora online is accessible in the settings. nginx is configured like this:
location ^~/nc/ {
rewrite /nc(.*) $1 break;
[...]
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:4000;
}
Maybe I am missing an important setting here...
Thanks for your help! 😄
I have a similar issue here, I tried to run the commands:
./occ config:app:set --value https:/my.domain.tld/nextcloud/custom_apps/richdocumentscode/proxy.php?req= richdocuments wopi_url
(which works fine) and ./occ richdocuments:activate-config
(as specified in the doc) but the latest results in an error :
Failed to activate any config changes
Client error: `GET https://my.domain.tld/nextcloud/nextcloud/custom_apps/richdocumentscode/proxy.php?req=/hosting/discovery` resulted in a `404 Not Found` response:
<!DOCTYPE html>
<html class="ng-csp" data-placeholder-focus="false" lang="en" data-locale="en" translate="no" >
<head
(truncated...)
#0 /var/www/html/3rdparty/guzzlehttp/guzzle/src/Middleware.php(69): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response), NULL, Array, NULL)
...
It seems the wopi_url
parameter might not be correctly parsed, and in this case, is doubly appended the /nextcloud
extension.
However, as Lulaschkas, in the frontend of my nextcloud documents apps, I have an issue where I spotted that some requests get 404 errors as they try to reach routes in the server without appending the /nextcloud
, really weird.
If anyone has a clue about this I'd be glad to hear it, thanks !
To complement @Robb-Fr's issue and provide some info on where the issue occurs:
When opening a file in Nextcloud (like a .odt), the js script document.js produces a request with an invalid URL by getting the host URL with Config.get('urlsrc')
at line 36. This config object can be found in config.tsx.
I don't know yet how to precise the correct 'urlsrc' option in order to be compatible with sub-path in URL like https://my.domain.com/nextcloud
Our first thought was that can be achieved by setting wopi_url
to the correct value but it results in other issues..