Proxy error with collabora

I am trying to get collabora running with Docker, following the instructions here: https://nextcloud.com/collaboraonline/

Everything seems to have gone well, there were no errors during setup but I am unable to open any documents when I click them in the Nextcloud interface. The error that is thrown is this one:

Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request POST /loleaflet/0adc773/loleaflet.html

Reason: Error reading from remote server.

I have tried some troubleshooting steps, to see if Docker is running, etc. but that doesn’t appear to be the problem.

docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4c3d595d09ff collabora/code “/bin/sh -c 'bash st…” 14 minutes ago Up 14 minutes 127.0.0.1:9980->9980/tcp pensive_panini

The only log line that is relevant seems to be this one, in /var/log/apache/other_vhosts_access.log which says:

office.example.com:443 89.39.x.x - - [21/Aug/2018:09:31:57 +0200] “POST /loleaflet/0adc773/loleaflet.html?WOPISrc=https%3A%2F%2Fwww.example.com%2Fnextcloud%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F30000_ocu9bw3w97bm&title=%20first%20ten%20chapters.docx&lang=en&closebutton=1&revisionhistory=1 HTTP/1.1” 502 4150 “-” “Mozilla/5.0 (X11; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0”

502 is a gateway error but I can’t seem to figure out why it seems to be throwing that.

I am running both Nextcloud and Collabora/CODE on the same machine, which is an Ubuntu 16.04 LTS based VPS, with latest Apache, etc. Certificates for www.example.com and office.example.com are both valid Let’s Encrypt certificates. DNS is working too.
I have tried restarting Docker but this doesn’t seem to do the trick.

Any troubleshooting suggestions are welcome. I can provide additional information when asked.

It works now! The trouble is, I am not sure what happened that made it work eventually. There’s been a couple of things that changed since my initial post.

  • There was an update to the docker-ce package for Ubuntu 16.04, which I installed.

  • I moved the Nextcloud installation from a sub-directory under the main domain to a subdomain of its own. (https://www.example.com/nextcloud >>> https://cloud.example.com) I followed the instructions as listed here: https://markus-blog.de/index.php/2018/06/05/how-to-migrate-nextcloud-to-a-new-server-with-ubuntu-16-04-lts/

  • I completely removed all traces of all collabora/code images on my server:
    $ sudo docker stop [imagenr] && sudo docker rm [[imagenr]] (you can find the image number using the command $ sudo docker ps)
    $ sudo docker container prune
    $ sudo docker rmi collabora/code

  • I then downloaded the latest collabora/code image again:
    $ sudo docker pull collabora/code
    When finished, I started the image:
    $ sudo docker run -t -d -p 127.0.0.1:9980:9980 -e ‘domain=cloud\\.example\\.com’ -e ‘username=admin’ -e 'password= --restart always --cap-add MKNOD collabora/code

  • I restarted both the Apache and Docker services.

After restarting these services, I could open, edit and save Office documents directly in the Nextcloud interface using Collabora. So again, I don’t know what fixed it. But it seems fixed.

I hope the fix stays after a reboot of the VPS but in theory, it should. I hope this helps someone else struggling with the same issue.

Somewhat to my surprise, the configuration above DOES survive a reboot of the VPS, so I guess that means it’s working now! Thank you @Sanook for the link.