Collabora can't open documents. Nextcloud 29 AIO; Apache Reverse Proxy

At some point in the past Nextcloud office could open documents. But now I get the error:

Failed to establish socket connection or socket connection closed unexpectedly. The reverse proxy might be misconfigured, please contact the administrator. For more info on proxy configuration please checkout

I have used Nextcloud AIO, with AIO running behind a reverse proxy on an Apache server. I have followed the instructions for troubleshooting collabora. I verified that my etc/hosts/ file doesn’t map or to my domain. I tried adding , to the allow list for WOPI requests, but this didn’t fix the problem.

I have also checked that my reverse proxy consideration supports the websocket.

Here is the output of curl -vvv https://$NC_DOMAIN:443/hosting/discovery in the nextcloud-aio-nextcloud docker container.

Here is my collabora log from AIO. (It’s too big for, so I used, which will expire in 21 days).

as the system complains about websocket I would focus on this area first.

Review if your reverse proxy config (from:

Enable proxy of websockets: a2enmod proxy_wstunnel

the config file should have similar line

 # Main websocket
 ProxyPassMatch      "/cool/(.*)/ws$"      wss://$1/ws nocanon

Hi, did you compare the apache config with this one? all-in-one/ at main · nextcloud/all-in-one · GitHub

1 Like

I’m using AIO. Proxy of websockets is enabled in the host server. The line is in the /etc/apache2/conf-available/coolwsd.conf file in the collabora docker container. But I’m having trouble following how the container is set up compared to collabora documentation. So I would appreciate some more detailed instructions about how to check if the container is setup correct.

I followed that page when I configured my apache. The only difference is that I have specified ports in the ServerName i.e.,:


Can you post the apache config here that you are using?

1 Like
<VirtualHost *:80>

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    RewriteCond %{SERVER_NAME}
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

<VirtualHost *:443>

    # Reverse proxy based on
    RewriteEngine On
    ProxyPreserveHost On
    RequestHeader set X-Real-IP %{REMOTE_ADDR}s
    AllowEncodedSlashes NoDecode
    ProxyPass / http://localhost:11000/ nocanon
    ProxyPassReverse / http://localhost:11000/

    RewriteCond %{HTTP:Upgrade} websocket [NC]
    RewriteCond %{HTTP:Connection} upgrade [NC]
    RewriteCond %{THE_REQUEST} "^[a-zA-Z]+ /(.*) HTTP/\d+(\.\d+)?$"
    RewriteRule .? "ws://localhost:11000/%1" [P,L]

    # Enable h2, h2c and http1.1
    Protocols h2 h2c http/1.1
    # Solves slow upload speeds caused by http2
    H2WindowSize 5242880

    # TLS

    SSLEngine               on
    SSLProtocol             -all +TLSv1.2 +TLSv1.3
    SSLHonorCipherOrder     off
    SSLSessionTickets       off
    # If running apache on a subdomain (eg. of a domain that already has an wildcard ssl certificate from certbot on this machine, 
    # the <your-nc-domain> in the below lines should be replaced with just the domain (eg., not the subdomain. 
    # In this case the subdomain should already be secured without additional actions
    # SSLCertificateFile /etc/letsencrypt/live/
    # SSLCertificateKeyFile /etc/letsencrypt/live/

    # Disable HTTP TRACE method.
    TraceEnable on
    <Files ".ht*">
        Require all denied

    # Support big file uploads
    LimitRequestBody 0

I think this is actually the problem.

Have you tried ServerName

1 Like

That was the issue. I forgot why I put the port there in the first place. But after removing it and restarting apache collabora works again.

1 Like