Issue with Onlyoffice & Nextcloud behind Caddy reverse proxy - docker compose

Hi everyone,

I have just tried to setup onlyoffice with nextcloud which is running in a docker compose setup behind a local caddy reverse proxy.

I first had the issue mentioned in other posts, that I wasn’t able to get the api.js file when opening a document, i.e. not being able to reach the document server from outside. I was able to fix that in caddy by adding the route /ds-vpath/ part.

This works and I don’t get a “cannot reach onlyoffice server” error anymore. I still get a 404 error, however. This happens when opening a document. I think something with the paths/routes is wrong but I can’t figure out what. The local connection check works well between nextcloud and onlyoffice so it can only be a reverse proxy issue I assume.

This is the error response for the path that cannot be reached:

https://cloud.myserver.de/7.5.1-23/web-apps/apps/documenteditor/main/index_loader.html?_dc=7.5.1-23&lang=en&customer=ONLYOFFICE&frameEditorId=iframeEditor&compact=true&parentOrigin=https://cloud.myserver.de&uitheme=theme-dark&fileType=docx

The location it tries to reach starts with 7.5.1-23 - the version number - instead of /ds-vpath/ as specified in the nextcloud configuration. Do I have to set /ds-vpath/ somewhere else as well?

I would greatly appreciate any help!

Nextcloud onlyoffice config:

    'DocumentServerUrl' => '/ds-vpath/',
    'DocumentServerInternalUrl' => 'http://onlyoffice/',
    'StorageUrl' => 'http://nextcloud/',
    'jwt_secret' => 'secret',

Caddyfile

cloud.myserver.de {
        redir /.well-known/carddav /remote.php/dav/ 301
        redir /.well-known/caldav /remote.php/dav/ 301

        header Strict-Transport-Security "max-age=15552000; includeSubdomains;"

        route /ds-vpath/* {
                uri strip_prefix /ds-vpath
                reverse_proxy 100.10.0.3:80  // docker ip-address
        }       

        reverse_proxy localhost:800 {
                header_up X-Real-IP {remote_host}
        }
}