NC + Collabora - Unable to get working - document loading failed

Hello,

I am fighting with connecting NC + Collabora already two days and still, I am not able to make it run correctly :sob: I am out of ideas and hence it’s not usual for me, I need to ask for help.

I have tried to use built-in Collabora app but we are using a chrooted FPM which is probably not compatible with chroot environment. Therefore I have switched to the Docker version but I have still issues with running Collabora (especially with SSL and Reverse proxy - I have problems with permissions / owner of some directories in the Docker container). After that, I decided to run a standalone server for Collabora as it is described on the Collabora official page. Now I have correctly running Collabora VM server.

For a better understanding of my infra: I have one reverse proxy (nginx) with a public IP, one VM with NC (private IP) and one Collabora VM, also with private IP. Collabora has configured SSL termination enabled and ssl.enabled to false.

nginx vhost configuration for collabora looks like this:

...
 # static files
 location ^~ /browser {
   proxy_pass http://10.0.10.130:9980;
   proxy_set_header Host $http_host;
 }

 # WOPI discovery URL
 location ^~ /hosting/discovery {
   proxy_pass http://10.0.10.130:9980;
   proxy_set_header Host $http_host;
 }

 # Capabilities
 location ^~ /hosting/capabilities {
   proxy_pass http://10.0.10.130:9980;
   proxy_set_header Host $http_host;
 }

 # main websocket
 location ~ ^/cool/(.*)/ws$ {
   proxy_pass http://10.0.10.130:9980;
   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header Connection "Upgrade";
   proxy_set_header Host $http_host;
   proxy_read_timeout 36000s;
 }

 # download, presentation and image upload
 location ~ ^/(c|l)ool {
   proxy_pass http://10.0.10.130:9980;
   proxy_set_header Host $http_host;
 }

 # Admin Console websocket
 location ^~ /cool/adminws {
   proxy_pass http://10.0.10.130:9980;
   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header Connection "Upgrade";
   proxy_set_header Host $http_host;
   proxy_read_timeout 36000s;
 }
...

It is listening on 443 / SSL with Let’s Encrypt. Collabora is reachable from the browser (endpoints browser, /hosting/discovery or /hosting/capabilities are available and loads in browser).

In the Office app in the NC I have configured the URL of Collabora and the app say that server is reachable.

The issue I am facing with is:

When I open any document (new, existing one) the page is loading and after a while I’ve got message: Document loading failed.

In the NC log is logged nothing. In the Collabora log no error message is logged. When I enable debug log in Collabora, I can see that document should be served correctly and request from NC is proceeding. No error. When I open a Developer console in the browser I can see many errors like this, which I am really not able to debug more or understand what is going wrong and how to solve it:

Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON data
    PostMessageReadyListener https://docserver1.xxx.eu/browser/1e92cc5/cool.html?WOPISrc=https://app.xxx.eu/index.php/apps/richdocuments/wopi/files/1047_ocj09au06x6t&title=Document.docx&lang=cs&closebutton=1&revisionhistory=1:23
    EventListener.handleEvent* https://docserver1.xxx.eu/browser/1e92cc5/cool.html?WOPISrc=https://app.xxx.eu/index.php/apps/richdocuments/wopi/files/1047_ocj09au06x6t&title=Document.docx&lang=cs&closebutton=1&revisionhistory=1:29
cool.html:23:20
SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON data
    _postMessageListener https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    handler https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    _on https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    on https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    addHooks https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    enable https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    addHandler https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    init https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    callInitHooks https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    initialize https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    NewClass https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    map https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    <anonymous> https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    <anonymous> https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    <anonymous> https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
bundle.js:1:1829343
Firefox can't establish connection to server wss://docserver1.xxx.eu/cool/https%3A%2F%2Fapp.xxx.eu%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F1047_ocj09au06x6t%3Faccess_token%3DqwSalpjD4ekeGSVQHMMlJTdQ0bacKaSB%26access_token_ttl%3D0%26permission%3Dedit/ws?WOPISrc=https%3A%2F%2Fapp.xxx.eu%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F1047_ocj09au06x6t&compat=/ws. cool.html:254:12275
SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON data
    _postMessageListener https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    handler https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    _on https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    on https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    addHooks https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    enable https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    addHandler https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    init https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    callInitHooks https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    initialize https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    NewClass https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    map https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    <anonymous> https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    <anonymous> https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    <anonymous> https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
bundle.js:1:1829343
Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON data
    PostMessageReadyListener https://docserver1.xxx.eu/browser/1e92cc5/cool.html?WOPISrc=https://app.xxx.eu/index.php/apps/richdocuments/wopi/files/1047_ocj09au06x6t&title=Document.docx&lang=cs&closebutton=1&revisionhistory=1:23
    EventListener.handleEvent* https://docserver1.xxx.eu/browser/1e92cc5/cool.html?WOPISrc=https://app.xxx.eu/index.php/apps/richdocuments/wopi/files/1047_ocj09au06x6t&title=Document.docx&lang=cs&closebutton=1&revisionhistory=1:29
cool.html:23:20
PostMessageService.sendPostMessage loolframe {"MessageId":"Host_PostmessageReady","SendTime":1640768646781,"Values":{}} postMessage.tsx:57:10
SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON data
    _postMessageListener https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    handler https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    _on https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    on https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    addHooks https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    enable https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    addHandler https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    init https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    callInitHooks https://docserver1.xx.eu/browser/1e92cc5/bundle.js:1
    initialize https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    NewClass https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    map https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    <anonymous> https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    <anonymous> https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
    <anonymous> https://docserver1.xxx.eu/browser/1e92cc5/bundle.js:1
bundle.js:1:1829343
GETwss://docserver1.xxx.eu/cool/https://app.xxx.eu/index.php/apps/richdocuments/wopi/files/1047_ocj09au06x6t?access_token=qwSalpjD4ekeGSVQHMMlJTdQ0bacKaSB&access_token_ttl=0&permission=edit/ws?WOPISrc=https://app.xxx.eu/index.php/apps/richdocuments/wopi/files/1047_ocj09au06x6t&compat=/ws
[HTTP/1.1 101 Switching Protocols 118ms]

Firefox can't establish connection to wss://docserver1.xxx.eu/cool/https%3A%2F%2Fapp.xxx.eu%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F1047_ocj09au06x6t%3Faccess_token%3DqwSalpjD4ekeGSVQHMMlJTdQ0bacKaSB%26access_token_ttl%3D0%26permission%3Dedit/ws?WOPISrc=https%3A%2F%2Fapp.xxx.eu%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F1047_ocj09au06x6t&compat=/ws.

I have tried a demo server in the Office app and it worked fine. I am really absolutely out of any ideas and desperate :frowning:

Nextcloud version: 23.0.0
Operating system and version: Debian Buster
Apache or nginx version: nginx on reverse proxy 1.14.2, apache on NC: 2.4.38
PHP version: 8.0.12 Chrooted FPM

Thank you for any help. I am really out of any ideas…

Any ideas, please? No one? I spent another half day working on it but without any results.

hi @brianv

the log looks like there is an issue with reverse proxy:

Firefox can't establish connection to server wss://docserver1.xxx.eu/cool/https%3A%2F%2Fapp.xxx.eu%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F1047_ocj09au06x6t%3Faccess_token%3DqwSalpjD4ekeGSVQHMMlJTdQ0bacKaSB%26access_token_ttl%3D0%26permission%3Dedit/ws?WOPISrc=https%3A%2F%2Fapp.xxx.eu%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F1047_ocj09au06x6t&compat=/ws. cool.html:254:12275

please carefully work through discussions on this forum - you find useful troubleshooting hints

Thank you, @wwe, appreciate your response. I have already read almost all posts and threads regarding this topic.

Anyway, your post and my (hundred)double-check that everything (including solutions described in other topics) I have configured correctly, and your note about the reverse proxy issue brings me to one and only possible place with a different configuration. I have some tweaks in nginx.conf where I had (except other settings) this little line:

proxy_hide_header Upgrade;

which caused my misery and malfunction. After removing this configuration parameter, everything works like a charm.

So, thanks a lot, it brought me to the new way I did not look.

1 Like