nextcloud / richdocuments

📑 Collabora Online for Nextcloud
https://nextcloud.com/collaboraonline
355 stars 116 forks source link

Feature request: make WOPISrc configurable #723

Open lutzgruber opened 4 years ago

lutzgruber commented 4 years ago

Hi, this is a feature request for function getWopiUrl in source file richdocuments/src/helpers/url.js:

The current definition of the WOPI URL as const wopiurl = window.location.protocol + '//' + window.location.host + getRootUrl() + '/index.php/apps/richdocuments/wopi/files/' + fileId leads to problems when the libreoffice online webservice cannot access the nextcloud service at the location of the browser window (window.location.protocol + '//' + window.location.host).

This can be the case when different proxies or firewall restrictions apply to the end user's device and the libreoffice online webservice host. A trivial way to reproduce this problem is to access nextcloud at localhost; the libreoffice online webservice then receives a localhost URL that it cannot resolve if it runs in a different docker container or on a different machine.

My proposed solution is to add a config setting wopi_host on the CODE admin page that lets the nextcloud admin specify the wopi host, and to use that host instead of window.location.protocol + '//' + window.location.host to define wopiurl in richdocuments/src/helpers/url.js.

Thank you.

juliusknorr commented 4 years ago

I would be fine with that similar to the public_wopi_url config switch we have in https://github.com/nextcloud/richdocuments/pull/483

Pull requests are welcome.

lutzgruber commented 4 years ago

Could you please provide any pointers how I can access (server-side) config settings from client-side javascript code?

xi commented 2 years ago

I have a setup where nextcloud and collabora are running on the same host and the reverse proxy that is doing the tls termination is relatively slow. Am I right to assume that the proposed setting would allow me to set WOPISrc to http://localhost/nextcloud/ and therefore bypass the reverse proxy? That would be very useful!