OnlyOffice Integration changes between V12 and V13

The “download failed” error in OnlyOffice when using a subfolder is usually caused by the Document Server not correctly understanding its public URL path, which prevents it from communicating back to Seafile.

I suggest you check onlyoffice’s log to see which URL it use to download a file from Seafile.

In the Seafile V13 Caddy-based setup, you need to ensure that Caddy sends a specific header telling OnlyOffice it is being served from /onlyofficeds.

Please try updating your onlyoffice.yml (or your main docker-compose.yml if integrated) with these specific labels for the OnlyOffice service:

services:
  onlyoffice:
    # ... other config ...
    labels:
      caddy: yourdomain.com
      caddy.handle_path: /onlyofficeds/*
      caddy.handle_path.reverse_proxy: "{{upstreams}}"
      caddy.handle_path.reverse_proxy.header_up: X-Forwarded-Host {host}/onlyofficeds

Why this is needed:

  1. handle_path: This automatically strips the /onlyofficeds prefix before sending the request to the OnlyOffice container (which expects to be at the root internally).
  2. X-Forwarded-Host: This is the critical part. By setting it to {host}/onlyofficeds, you tell OnlyOffice that its external base URL includes the subfolder. Without this, OnlyOffice might try to request files from yourdomain.com/ instead of yourdomain.com/onlyofficeds/, leading to the “download failed” error.

Checklist:

  • Trailing Slashes: In your seahub_settings.py, ensure ONLYOFFICE_APIJS_URL points to the full path: https://yourdomain.com/onlyofficeds/web-apps/apps/api/documents/api.js.
  • JWT Secret: Since you mention it works on a subdomain, your JWT secret is likely correct.
  • Internal Resolution: Ensure the OnlyOffice container can resolve yourdomain.com. If they are on the same machine, you might need to add an extra_hosts entry to the onlyoffice service in your docker-compose file pointing your domain to the host’s IP.

For further reference, a similar configuration was discussed in the community here: OnlyOffice not working behind caddy.

2 Likes