Collabora office fails in one Nextcloud instance but works on another

For the last few days I’ve been reading on this forum and the Collabora integration support, but I am completely unable to fix my issues.

I’ve been working with a home setup of Nextcloud and Collabora office for years without problems (www.instanceA.com for this example). Recently I’ve decided to set up a second Nextcloud instance in my PC (nextcloud.web.com for this example) but wanted to reuse the same CODE instance (office.instanceA.com here).

I’ve set up the Collabora service in docker-compse.yml file with the following options to support both URLs and handle reverse proxy:

      - DONT_GEN_SSL_CERT=1
      - "extra_params=--o:ssl.enable=false --o:ssl.termination=true"
      - aliasgroup1=https://www.instanceA.com:443,https://www\\.instanceA\\.com:443
      - aliasgroup2=https://http://nextcloud.web.com:443,https://nextcloud\\.web\\.com:443

On top of that, I’ve set up the office connection in the second instance through occ, getting all green checks:

✓ Set callback url to https://nextcloud.web.com
Checking configuration
🛈 Configured WOPI URL: https://office.instanceA.com
🛈 Configured public WOPI URL: https://office.instanceA.com
🛈 Configured callback URL: https://nextcloud.web.com

✓ Fetched /hosting/discovery endpoint
✓ Valid mimetype response
✓ Valid capabilities entry
✓ Fetched /hosting/capabilities endpoint
✓ Detected WOPI server: Collabora Online Development Edition 25.04.3.2

Collabora URL (used for Nextcloud to contact the Collabora server):
  https://office.instanceA.com
Collabora public URL (used in the browser to open Collabora):
  https://office.instanceA.com
Callback URL (used by Collabora to connect back to Nextcloud):
  https://nextcloud.web.com

Current setup and versions

  • Nextcloud Server version 31.0.0 on both instances
  • Docker compose with nextcloud:31.0.0-fpm-alpine
  • Web server and version jwilder/nginx-proxy for reverse proxy

Summary of the issue you are facing:

After the explained setup, I am able to correctly open files as always through my original instance, but not through the new one, the error I get reads:

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 https://sdk.collaboraonline.com/docs/installation/Proxy_settings.html

Log entries

Collabora

The only relevant logs I could see, where I guess the problem lies, but I’ve not been able to fix are in the collabora instance and as follows:

app-collabora  | wsd-00001-00022 2025-07-13 15:55:18.507492 +0000 [ websrv_poll ] ERR  Failed to fetch preset uri[http://nextcloud.web.com/apps/richdocuments/settings/systemconfig/hYlqctsIiYZljKx2jjpSEO2QdHBXVA8F/xcu/documentView.xcu] with status[Moved Permanently]| wsd/DocumentBroker.cpp:1952
app-collabora  | wsd-00001-00022 2025-07-13 15:55:18.507726 +0000 [ websrv_poll ] ERR  #-1: Failed to install config [shared-https_nextcloud.web.com/index.php/apps/richdocuments/wopi/settings-686f9bc5a58f3686cf93905229]| wsd/RequestVettingStation.cpp:195
app-collabora  | wsd-00001-00022 2025-07-13 15:55:21.804260 +0000 [ websrv_poll ] ERR  Failed to fetch preset uri[http://nextcloud.web.com/apps/richdocuments/settings/systemconfig/mw82yBmjypi4QH5RxswJmnd5Jo5EjwVg/xcu/documentView.xcu] with status[Moved Permanently]| wsd/DocumentBroker.cpp:1952
app-collabora  | wsd-00001-00022 2025-07-13 15:55:21.804303 +0000 [ websrv_poll ] ERR  #-1: Failed to install config [shared-https_nextcloud.web.com/index.php/apps/richdocuments/wopi/settings-686f9bc5a58f3686cf93905229]| wsd/RequestVettingStation.cpp:195

Looks like it tries to connect to the new nextcloud instance through http instead of https and gets a 301 response, which interprets as invalid and then the rest of the process doesn’t work correctly. At some point I did even get to see the office GUI, but ended up showing the same error after a moment.

For reference this is my config.php in the new instance:

    server app-nextcloud:9000;
    #server unix:/var/run/php/php7.4-fpm.sock;
}

# server {
#     listen 80;
#     listen [::]:80;
#     server_name cloud.example.com;
#     # enforce https
#     return 301 https://$server_name:443$request_uri;
# }

server {
    listen 80;
    listen [::]:80;
    server_name nextcloud.web.com
    # Add headers to serve security related headers
    # Before enabling Strict-Transport-Security headers please read into this
    # topic first.
    # add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
    #
    # WARNING: Only add the preload option once you read about
    # the consequences in https://hstspreload.org/. This option
    # will add the domain to a hardcoded list that is shipped
    # in all major browsers and getting removed from this list
    # could take several months.
    add_header Referrer-Policy "no-referrer" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-Download-Options "noopen" always;
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-Permitted-Cross-Domain-Policies "none" always;
    add_header X-Robots-Tag "none" always;
    add_header X-XSS-Protection "1; mode=block" always;

    # Remove X-Powered-By, which is an information leak
    fastcgi_hide_header X-Powered-By;

    # Path to the root of your installation
    root /var/www/nextcloud;

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    # The following 2 rules are only needed for the user_webfinger app.
    # Uncomment it if you're planning to use this app.
    #rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
    #rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;

    # The following rule is only needed for the Social app.
    # Uncomment it if you're planning to use this app.
    #rewrite ^/.well-known/webfinger /public.php?service=webfinger last;

    location = /.well-known/carddav {
        return 301 $scheme://$host:$server_port/remote.php/dav;
    }
    location = /.well-known/caldav {
        return 301 $scheme://$host:$server_port/remote.php/dav;
    }

    # set max upload size
    client_max_body_size 512M;
    fastcgi_buffers 64 4K;

    # Enable gzip but do not remove ETag headers
    gzip on;
    gzip_vary on;
    gzip_comp_level 4;
    gzip_min_length 256;
    gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
    gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;

    # Uncomment if your server is build with the ngx_pagespeed module
    # This module is currently not supported.
    #pagespeed off;

    location / {
        rewrite ^ /index.php;
    }

    location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
        deny all;
    }
    location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) {
        deny all;
    }

    location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy)\.php(?:$|\/) {
        fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
        set $path_info $fastcgi_path_info;
        try_files $fastcgi_script_name =404;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $path_info;
        fastcgi_param HTTPS on;
        # Avoid sending the security headers twice
        fastcgi_param modHeadersAvailable true;
        # Enable pretty urls
        fastcgi_param front_controller_active true;
        fastcgi_pass php-handler;
        fastcgi_intercept_errors on;
        fastcgi_request_buffering off;
    }

    location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) {
        try_files $uri/ =404;
        index index.php;
    }

    # Adding the cache control header for js, css and map files
    # Make sure it is BELOW the PHP block
    location ~ \.(?:css|js|woff2?|svg|gif|map)$ {
        try_files $uri /index.php$request_uri;
        add_header Cache-Control "public, max-age=15778463";
        # Add headers to serve security related headers (It is intended to
        # have those duplicated to the ones above)
        # Before enabling Strict-Transport-Security headers please read into
        # this topic first.
        #add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
        #
        # WARNING: Only add the preload option once you read about
        # the consequences in https://hstspreload.org/. This option
        # will add the domain to a hardcoded list that is shipped
        # in all major browsers and getting removed from this list
        # could take several months.
        add_header Referrer-Policy "no-referrer" always;
        add_header X-Content-Type-Options "nosniff" always;
        add_header X-Download-Options "noopen" always;
        add_header X-Frame-Options "SAMEORIGIN" always;
        add_header X-Permitted-Cross-Domain-Policies "none" always;
        add_header X-Robots-Tag "none" always;
        add_header X-XSS-Protection "1; mode=block" always;

        # Optional: Don't log access to assets
        access_log off;
    }

    location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap|mp4|webm)$ {
        try_files $uri /index.php$request_uri;
        # Optional: Don't log access to other assets
        access_log off;
    }
}

Thanks for your time and let me know if you need any more information, I don’t see how else to get this to work.

Hey @jsmtux welcome to the community :waving_hand:

that doesn’t look right… please double check you syntax, see

Thanks for the welcome and response!
The issue you identified was only because of my edits of the configuration, where I changed the real URLs for fake ones, I fixed it already.
Other than that didn’t do any edits, keeping everything as close as possible to the original.

your example still looks weird - please double check

I don’t really get the point why add each domain twice? likely you try to workaround escaping problems but maybe you brake the whole integration this way. First NC instance always work so this might work occasionally..

Regarding multi-domain setup please look at

and also review CODE logs - often they clearly point out the problem.

Hi! I fixed up the aliasgroup and that did help with the office settings in the nextcloud administration configuration, those weren’t working before. Nothing else, though.

The logs for CODE when I try opening something from the new instance are

app-collabora  | wsd-00001-00024 2025-07-14 10:55:20.633945 +0000 [ websrv_poll ] ERR  Failed to fetch preset uri[http://nextcloud.web.com/apps/richdocuments/settings/systemconfig/aCgP483zX8jAHJLkvl8Eh86j9zhT0uuZ/xcu/documentView.xcu] with status[Moved Permanently]| wsd/DocumentBroker.cpp:1952
app-collabora  | wsd-00001-00024 2025-07-14 10:55:20.634111 +0000 [ websrv_poll ] ERR  #-1: Failed to install config [shared-https_nextcloud.web.com/index.php/apps/richdocuments/wopi/settings-68741b52d6e74686cf93905229]| wsd/RequestVettingStation.cpp:195

I don’t see any more logs using docker logs and no log file in /var/log. The part I find weird is that it somehow tries to fetch that preset uri by using http, whereas all other communication happens through https. Could that have something to do?

sounds like your NC is not aware of it’s proper address. likely it generates http:// URLs and you rewrite them with https redirection on the reverse proxy. Please review 101: reverse proxy

This topic was automatically closed after 90 days. New replies are no longer allowed.