diff --git a/config/config.inc.php.dist b/config/config.inc.php.dist --- a/config/config.inc.php.dist +++ b/config/config.inc.php.dist @@ -62,7 +62,7 @@ $config['fileapi_manticore'] = null; // WOPI/Office service URL. Enables use of collaborative editor supporting WOPI. -// Note: this URL should be accessible from Chwala host and Roundcube host as well. +// Note: this URL must be accessible from the Chwala host. $config['fileapi_wopi_office'] = null; // Name of the user interface skin. @@ -73,6 +73,9 @@ // the UI location is used with addition of /api/ suffix. $config['file_api_url'] = ''; +// Optional server variant of file_api_url if the wopi service needs to connect via an internal url back to chwala. +$config['file_api_server_url'] = null; + // Type of Chwala cache. Supported values: 'db', 'apc' and 'memcache'. // Note: This is only for some additional data like WOPI capabilities. $config['fileapi_cache'] = 'db'; diff --git a/lib/file_wopi.php b/lib/file_wopi.php --- a/lib/file_wopi.php +++ b/lib/file_wopi.php @@ -97,8 +97,10 @@ return; } - $office_url = rtrim($metadata['urlsrc'], ' /?'); // collabora - $service_url = $this->api->api_url() . '/wopi/files/' . $id; + $office_url = rtrim($metadata['urlsrc'], ' /?'); // collabora + //Configurable if e.g. collabora does not connect via the public url + $service_url = $this->rc->config->get('file_api_server_url', $this->api->api_url()); + $service_url = rtrim($service_url, ' /') . '/wopi/files/' . $id; // @TODO: Parsing and replacing placeholder values // https://wopi.readthedocs.io/en/latest/discovery.html#action-urls