Could not establish connection to the Collabora Online server (Using "Collabora Online - Built-in CODE Server" option)

What is the problem I got:

  1. Due to some unavoidable reasons, I manually downloaded the package ā€˜richdocumentscode.tar.gzā€™ from https://apps.nextcloud.com/apps/richdocumentscode manuelly:


    (My nextcloud version is 28.0.3, installed by nextcloud-aio for docker)

  2. I extracted this package into the /var/www/html/apps/richdocumentscode/ directory in docker container.

045588c8ff7a:/var/www/html/apps/richdocumentscode# ls
CHANGELOG.md  LICENSE  NOTICES  appinfo  collabora  images  img  l10n  lib  proxy.php  templates
  1. I tried to open the nextcloud page in browser https://nextcloud.mydomain/settings/apps to enable the app ā€œCollabora Online - Built-in CODE Serverā€. After getting the app enabled:


  2. Then I tried to open ā€œNextcloud Officeā€ menu, I encountered this issue:


    It says:

Could not establish connection to the Collabora Online server.

Failed to connect to the remote server: cURL error 7: Failed to connect to nextcloud.weishifamily.space port 443 after 3 ms: Couldnā€™t connect to server (see libcurl - Error Codes) for https://nextcloud.weishifamily.space/apps/richdocumentscode/proxy.php?req=/hosting/discovery

What I tried:

045588c8ff7a:/var/www/html# curl -k https://nextcloud.weishifamily.space
curl: (7) Failed to connect to nextcloud.weishifamily.space port 443 after 9 ms: Couldn't connect to server


I know the error here, but I do not know what can I do?


Other info:
My nextcloud-aio is behind an nginx reverse-proxy, and my nginx server block is:

map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;
}

server {
    listen 80;
    listen [::]:80;            # comment to disable IPv6

    if ($scheme = "http") {
        return 301 https://$host$request_uri;
    }

    listen 443 ssl http2;      # for nginx versions below v1.25.1
    listen [::]:443 ssl http2; # for nginx versions below v1.25.1 - comment to disable IPv6

    server_name nextcloud.weishifamily.space;

    location / {
        proxy_pass http://127.0.0.1:11000$request_uri;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Port $server_port;
        proxy_set_header X-Forwarded-Scheme $scheme;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Accept-Encoding "";
        proxy_set_header Host $host;

        client_body_buffer_size 512k;
        proxy_read_timeout 86400s;
        client_max_body_size 0;

        # Websocket
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
    }

    ssl_certificate /etc/nginx/ssl/nextcloud.weishifamily.space_bundle.crt;
    ssl_certificate_key /etc/nginx/ssl/nextcloud.weishifamily.space.key;

    ssl_session_timeout 1d;
    ssl_session_cache shared:MozSSL:10m; # about 40000 sessions
    ssl_session_tickets off;

    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305;
    ssl_prefer_server_ciphers on;
}

(There is nothing strange, I copied this from Reverse Proxy Documentation and changed the SSL certification to my own.)

I have checked this Connecting to Collabora Online Server: Could not establish connection to the Collabora Online server and this Collabora integration guide, They talk about the option ā€œUse your own serverā€, but not the option ā€œUse the built-in CODE - Collabora Online Development Edition.ā€ Am I missing something?

Hi, in aio you should not need the richdocumentscode app. Please disable that again! Instead you should enable the collabora container cia the aio interface on port 8080. if that does not work, please follow How to debug problems with Collabora and/or Talk Ā· nextcloud/all-in-one Ā· Discussion #1358 Ā· GitHub

Hi, in aio you should not need the richdocumentscode app.

Oops, what a great misunderstanding! LOL.

Please disable that again!

Done!

Instead you should enable the collabora container cia the aio interface on port 8080.

I am sure the collabora container is enabled.

if that does not work, please follow How to debug problems with Collabora and/or Talk Ā· nextcloud/all-in-one Ā· Discussion #1358 Ā· GitHub

Ok, Iā€™ll do this.


  1. Check hosts:

A general step on Linux would first be to check if e.g. 127.0.0.1 yourdomain.com or e.g. 127.0.1.1 yourdomain.com was added to the /etc/hosts file on your host runnig the docker daemon. If that is the case, Remove it from the file and restart AIO which might already make things work.

No, I am not. my hosts looks OK:

127.0.0.1       localhost
127.0.1.1       DESKTOP-WES.wes.lan     DESKTOP-WES

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback nextcloud.weishifamily.space
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
  1. Check if websocket enabled:

If AIO is behind a reverse proxy, make sure that websocket are enabled in your reverse proxy config.

According to my nginx config, the websocket may enabled (but not very sure):

server {
    # ...
    location / {
        proxy_pass http://127.0.0.1:11000$request_uri;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Port $server_port;
        proxy_set_header X-Forwarded-Scheme $scheme;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Accept-Encoding "";
        proxy_set_header Host $host;

        client_body_buffer_size 512k;
        proxy_read_timeout 86400s;
        client_max_body_size 0;

        # Websocket
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
    }
    # ...
}
  1. Check if Allow list for WOPI requests input field shown.
    No.

  2. Get some logs

If the steps above do not make it work, see the debugging steps below:

qiuweishi@DESKTOP-WES:~$ sudo docker exec -it nextcloud-aio-nextcloud bash
045588c8ff7a:/var/www/html# curl -vvv https://nextcloud.mydomain.space:443/hosting/discovery
* Host nextcloud.mydomain.space:443 was resolved.
* IPv6: 240e:3bb:xxxx:xxxx:xxxx:5bff:fe41:3289
* IPv4: (none)
*   Trying [240e:3bb:xxxx:xxxx:xxxx:5bff:fe41:3289]:443...
* Immediate connect fail for 240e:3bb:xxxx:xxxx:xxxx:5bff:fe41:3289: Address not available
* Failed to connect to nextcloud.mydomain.space port 443 after 7 ms: Couldn't connect to server
* Closing connection
curl: (7) Failed to connect to nextcloud.mydomain.space port 443 after 7 ms: Couldn't connect to server

There is logs for collabora container:
https://pastecode.io/s/1ytirmsk

This is your problem. It seems like your domain is not reachable from inside the container. Most likely your router or firewall or your network infrastructure is causing this. You can fix this by setting up a local dns server. See GitHub - nextcloud/all-in-one: The official Nextcloud installation method. Provides easy deployment and maintenance with most features included in this one Nextcloud instance.

Sure, Iā€™ll try it. Thanks for your clarification.

So, I did it by editing the /etc/hosts file, which is a simpler solution for me.

# /etc/hosts in nextcloud/aio-nextcloud container, add this line:
172.17.0.1 nextcloud.mydomain
# 172.17.0.1 is the IP address of docker0. You can find it by running `sudo ip addr show docker0` on the host.

Do the same in the nextcloud/aio-collabora container.

The reason why I canā€™t access nextcloud.mydomain in nextcloud-aio-nextcloud is because my domain is an IPv6 domain, and I have no public IPv4 address.

Of course, this solution is similar to using a local DNS server, but itā€™s just simpler. Iā€™m posting it in case anybody is interested.

Note: the command sudo docker exec -it {container_id} bash will execute Collabora with the user ā€˜coolā€™. Instead, you should run sudo docker exec -it --user root {container} bash.

please be aware all modifications inside the container are gone once there is an update and you have to repeat editing hosts file after each container changeā€¦

Update: after reading through the topic again I see you can use docker network alias as described here: Probably DNS help with NC Docker + Collabora + Wireguard tunnel - #5 by wwe

1 Like

Thatā€™s right, thank you for pointing this out.