Document loading failed [solutions in forum does not help]

Support intro

Sorry to hear you’re facing problems. :slightly_frowning_face:

The community help forum (help.nextcloud.com) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are volunteering their time to help you.

If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via portal.nextcloud.com where Nextcloud engineers can help ensure your business keeps running smoothly.

Getting help

In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.

Before clicking submit: Please check if your query is already addressed via the following resources:

(Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can. :heart:

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 30.0.2
  • Operating system and version (e.g., Ubuntu 24.04):
    • Ubuntu 22.04.4 LTS
  • Web server and version (e.g, Apache 2.4.25):
    • nginx/1.18.0 (Ubuntu)
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • nginx/1.18.0 (Ubuntu)
  • PHP version (e.g, 8.3):
    • PHP 8.1.2-1ubuntu2.19 (cli) (built: Sep 30 2024 16:25:25) (NTS)
  • Is this the first time you’ve seen this error? (Yes / No):
    • yah
  • When did this problem seem to first start?
    • After installation
  • Installation method (e.g. AIO, NCP, Bare Metal/Archive, etc.)
    • Docker see below
  • Are you using Cloudflare, mod_security, or similar? (Yes / No)
    • No

Summary of the issue you are facing:

  1. I can’t open or edit any document using nextcloud office. The error message is:

Document loading failed Failed to load Nextcloud Office - please try again later

  1. I have followed this post here, and added WOPI 0.0.0.0/0 → did not work

  2. So I looked up Admin settings → logging. I found:

Client error:POST https://monsoon.my-site.org:4443/cool/extract-document-structure?limit=content-control` resulted in a 403 Forbidden response`

  1. So I followed this post here (indeed my collabora is set to a different port) , but no change.

Steps to replicate it (hint: details matter!):

  1. Install NextCloud, using Docker.

version: '3.9'

services:
  nextcloud:
    image: nextcloud:latest
    container_name: nextcloud
    restart: always
    ports:
      - 8080:80
    volumes:
      - /var/docker/nextcloud/data:/var/www/html
      - /var/docker/nextcloud/config:/var/www/html/config
    depends_on:
      - db

  db:
    image: mariadb
    container_name: nextcloud_db
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: secret pass
      MYSQL_DATABASE: nextcloud
      MYSQL_USER: nextcloud
      MYSQL_PASSWORD: other secret pass
    volumes:
      - /var/docker/nextcloud/db:/var/lib/mysql
  1. Configure Nginx reverse proxy:
server {
    listen 5021 ssl;
    server_name monsoon.my-site.org;

    ssl_certificate /etc/letsencrypt/live/monsoon.my-site.org/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/monsoon.my-site.org/privkey.pem; # managed by Certbot

    location / {
        proxy_pass http://127.0.0.1:8080/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

server {
    listen 80;
    server_name monsoon.my-site.org;
    return 301 https://$host$request_uri;
}

I can see the nextcloud install now.

  1. Set up collabora using docker:
version: '3.7'

services:
  collabora:
    image: collabora/code
    container_name: collabora
    restart: always
    ports:
      - "5022:9980"
    environment:
      - domain=monsoon.my-site.org
      - "extra_params=--o:ssl.enable=false --o:ssl.termination=true"
    volumes:
      - /opt/collabora/data:/var/www/collabora/data
      - /opt/collabora/loolwsd.xml:/etc/loolwsd/loolwsd.xml
  1. Configure nginx again:

server {
listen 4443 ssl;
server_name monsoon.my-site.org;

# Self-signed SSL certificates
ssl_certificate /etc/letsencrypt/live/monsoon.my-site.org/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/monsoon.my-site.org/privkey.pem; # managed by Certbot


ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;

# Proxy requests to the Collabora Docker container
location / {
    proxy_pass http://localhost:5022;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto https;
    #proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Port $server_port;
    proxy_set_header Forwarded "for=$remote_addr;proto=$scheme";
    #proxy_buffering off;
}

client_max_body_size 0;
fastcgi_buffers 64 4K;

# Disable buffering to prevent latency
#proxy_request_buffering off;

}

  1. Set instance of collabora to admin settings > office, with port # 4443. Then Restart everything
  2. Go back to the tab where nextcloud is open,. and then under apps > files > click on any odx document. (or even docx) - and the error is popping up.

Log entries

Nextcloud

Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your nextcloud.log located in your data directory). Feel free to use a pastebin/gist service if necessary.

{"reqId":"lywRjoeZcEGDexLp0usU","level":3,"time":"2024-11-29T10:03:00+00:00","remoteAddr":"79.117.107.52","user":"admin","app":"richdocuments","method":"GET","url":"/ocs/v2.php/apps/files/api/v1/templates","message":"Client error: `POST https://monsoon.my-site.org:4443/cool/extract-document-structure?limit=content-control` resulted in a `403 Forbidden` response","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:132.0) Gecko/20100101 Firefox/132.0","version":"30.0.2.2","data":{"app":"richdocuments"},"id":"674997689c36f"}

I edited the log to hide my url.

Web Browser

If the problem is related to the Web interface, open your browser inspector Console and Network tabs while refreshing (reloading) and reproducing the problem. Provide any relevant output/errors here that appear.

Request:

POST /browser/3799c094da/cool.html?WOPISrc=https%3A%2F%2Fmonsoon.my-site.org%3A5021%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F567_occmiu611x0t&title=%2FNew%20document.odt&lang=en&closebutton=1&revisionhistory=1 HTTP/1.1
Host: monsoonmy-site.org
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:132.0) Gecko/20100101 Firefox/132.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br, zstd
Content-Type: application/x-www-form-urlencoded
Content-Length: 4348
Origin: null
Connection: keep-alive
Cookie: nc_sameSiteCookielax=true; nc_sameSiteCookiestrict=true; __Host-nc_sameSiteCookielax=true; __Host-nc_sameSiteCookiestrict=true; occmiu611x0t=ecebbb737a6c5aa294173b9188848427; oc_sessionPassphrase=wWDd6l8H%2Fa2tMvjGeIVIwtpg7RcQnqMSRX395vo43mnmJqurY4d8%2FCvU5GV09zzugvFoM1AtaoWOOxKnUMMJfUvEsOY1Q%2FhQXWU19GcL4AiuF6RzHF9Wqa8UasvuX%2F6j; nc_username=admin; nc_token=YPyXL7hLyYC2X8ULniIBsuK17vh0h8Yl; nc_session_id=ecebbb737a6c5aa294173b9188848427
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: iframe
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-site
Sec-Fetch-User: ?1
Priority: u=4

Response:

HTTP/1.1 404 Not Found
Server: nginx/1.18.0 (Ubuntu)
Date: Fri, 29 Nov 2024 10:31:40 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Content-Encoding: gzip

Web server / Reverse Proxy

The output of your Apache/nginx/system log in /var/log/____:

[ N 2024-11-29 10:16:58.9382 153218/T1 age/Wat/WatchdogMain.cpp:1370 ]: Starting Passenger watchdog...
[ N 2024-11-29 10:16:58.9667 153222/T1 age/Cor/CoreMain.cpp:1341 ]: Starting Passenger core...
[ N 2024-11-29 10:16:58.9683 153222/T1 age/Cor/CoreMain.cpp:257 ]: Passenger core running in multi-application mode.
[ N 2024-11-29 10:16:58.9861 153222/T1 age/Cor/CoreMain.cpp:1016 ]: Passenger core online, PID 153222
[ N 2024-11-29 10:17:01.1207 153222/T6 age/Cor/SecurityUpdateChecker.h:519 ]: Security update check: no update found (next check in 24 hours)

(redmine is running on another port)

Configuration

Nextcloud

The output of occ config:list system or similar is best, but, if not possible, the contents of your config.php file from /path/to/nextcloud is fine (make sure to remove any identifiable information!):

$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),

  1 => 
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'upgrade.disable-web' => true,
  'instanceid' => 'will hide',
  'passwordsalt' => 'will hide',
  'secret' => 'will hide',
  'trusted_domains' => 
  array (
    0 => 'monsoon.my-site.org',
    1 => 'monsoon.my-site.org:5021',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'sqlite3',
  'version' => '30.0.2.2',
  'overwrite.cli.url' => 'http://monsoon.my-site.org:5021',
  'overwritehost' => 'monsoon.my-site.org:5021',
  'overwriteprotocol' => 'https',
  'installed' => true,
  'app_install_overwrite' => 
  array (
    0 => 'files_mindmap',
    1 => 'inventory',
    2 => 'files_3d',
  ),
);


Please help

Thank you.