OnlyOffice and Collabora show empty documents behind Caddy reverse proxy with subpath routing

Setup
  • Nextcloud 33 (FPM in Docker)
  • OnlyOffice Document Server 9.4.0 (Docker)
  • Collabora CODE (Docker)
  • Caddy 2 as reverse proxy (network_mode: host)
  • All services on same Docker network (appnet)
  • Accessed via Tailscale MagicDNS: https ://mijningang.mijntailnet.ts.net

Routing via Caddy

  • Nextcloud: https ://mijningang.mijntailnet.ts.net/
  • OnlyOffice: https ://mijningang.mijntailnet.ts.net/onlyoffice (handle_path)
  • Collabora: https ://mijningang.mijntailnet.ts.net/collabora (handle_path)

OnlyOffice settings

  • Document Editing Service address: https ://mijningang.mijntailnet.ts.net/onlyoffice
  • Internal requests (Nextcloud → OnlyOffice): http ://onlyoffice:80
  • Server address (OnlyOffice → Nextcloud): https ://mijningang.mijntailnet.ts.net

Problem

Documents open but are empty. OnlyOffice logs show:

error downloadFile: url=https ://mijningang.mijntailnet.ts.net/onlyoffice/index.php/apps/onlyoffice/empty
AxiosError: Request failed with status code 404

OnlyOffice is trying to download the file from a URL that combines
the OnlyOffice subpath with a Nextcloud path (/onlyoffice/index.php/…)
which results in a 404.

What works

  • https ://mijningang.mijntailnet.ts.net/onlyoffice/healthcheck → 200
  • docker exec nextcloud curl http ://onlyoffice:80/healthcheck → 200
  • DNS resolution inside Nextcloud container works for both
    .ts.net hostnames and Docker internal hostnames

Question

How should Caddy handle_path and OnlyOffice settings be configured
when OnlyOffice is served under a subpath (/onlyoffice) instead of
its own subdomain or root domain?