NextCloud + OnlyOffice - integration issues

I have been trying to integrate OnlyOffice with Nextcloud and not having much luck.

Nextcloud 13 running in a jail on FreeNAS.

OnlyOffice (non-docker) running on Ubuntu VM (Went the docker route previously and had no luck - same issue).

I am using HAProxy to route by domain name, with 2 SSLs:

cloud.XXXXXX.ddns.net
office.XXXXXX.ddns.net

I can access both of these perfectly.
NextCloud is working fine and OnlyOffice is displaying “Document Server is running”.

I can wget from each of the servers and it seems to be working correctly.

When I try to enter office.XXXXXX.ddns.net into the NextCloud integration app, it fails and gives me the error:

"Error when trying to connect. (Error occurred in the document service: Error while downloading the document file to be converted.)

and on the OnlyOffice VM - the OnlyOffice converter error logs show:

[2018-05-11 08:28:08.453] [ERROR] nodeJS - error downloadFile:url=https://office.xxxxx.ddns.net/index.php/apps/onlyoffice/empty?doc=RjlvOE1INmhNUFJNU2U2WE1KSlFGRFdIVWpSQUx4TXU2Q0t6cldlMXVmRT0/eyJhY3Rpb24iOiJlbXB0eSJ9;attempt=1;code:undefined;connect:undefined;(id=conv_check_1232009406_docx)
Error: Error response: statusCode:404 ;body:

Error
Cannot GET /index.php/apps/onlyoffice/empty
at Request._callback (/var/www/onlyoffice/documentserver/server/Common/sources/utils.js:249:18)
at Request.self.callback (/var/www/onlyoffice/documentserver/server/Common/node_modules/request/request.js:186:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/var/www/onlyoffice/documentserver/server/Common/node_modules/request/request.js:1163:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/var/www/onlyoffice/documentserver/server/Common/node_modules/request/request.js:1085:12)
at IncomingMessage.g (events.js:292:16)
at emitNone (events.js:91:20)

I have tried playing about with the Nextcloud settings:
‘onlyoffice’ =>
array (
‘verify_peer_off’ => TRUE,
)

But it did not make any difference.

I have tried to use the hosts file to point cloud.XXXXX.ddns.net and office.XXXXXX.ddns.net on each system to point to the local IP of HAProxy, but it makes no difference (wget still works).

Can anyone help?

It was the only way to get it working for me with a similar setup. Make sure you apply the settings and restart the Onlyoffice services. Then connect again in Nextcloud.
Once it works, best to add a ‘secret’ if you haven’t done already to ensure your server is not used by others.