Download files crash even for small files (it works from my local IP address)

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

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:

Nextcloud version (eg, 29.0.5): 29.0.4
Operating system and version (eg, Ubuntu 24.04): Ubuntu 24.04
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.58
PHP version (eg, 8.3): 8.3

The issue you are facing: Download files crash even for small files (it works from my local IP address)

Is this the first time you’ve seen this error? (Y/N): Y on a new fresh installation

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'XXXXXXX',
  'passwordsalt' => 'XXXXXX',
  'secret' => 'XXXXX',
  'trusted_domains' =>
  array (
    0 => '192.168.0.17',
    1 => 'mydomain.xyz',
  ),
  'datadirectory' => '/var/www/html/nc/data',
  'dbtype' => 'mysql',
  'version' => '29.0.4.1',
  'overwrite.cli.url' => 'http://192.168.0.17/nc',
  'dbname' => 'ncdb',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'SUPPRESSED',
  'installed' => true,
  'default_language' => 'fr',
  'default_locale' => 'fr_FR',
  'default_phone_region' => 'FR',
  'default_timezone' => 'Europe/Paris',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'maintenance_window_start' => 3,
  'memories.db.triggers.fcu' => true,
  'memories.exiftool' => '/var/www/html/nc/apps/memories/bin-ext/exiftool-amd64-glibc',
  'memories.vod.path' => '/var/www/html/nc/apps/memories/bin-ext/go-vod-amd64',
  'filelocking.enabled' => 'true',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'dbindex' => 0,
    'password' => '',
    'timeout' => 1.5,
  ),
);

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

192.168.0.254 - - [18/Aug/2024:09:46:23 +0000] "PROPFIND /nc/remote.php/dav/files/KENMAN/TEST/ HTTP/1.1" 207 1985 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36"
192.168.0.254 - - [18/Aug/2024:09:46:23 +0000] "POST /nc/index.php/apps/text/session/17/close HTTP/1.1" 200 869 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36"
192.168.0.254 - - [18/Aug/2024:09:46:33 +0000] "GET /nc/index.php/apps/logreader/api/poll?lastReqId=4SjCdWq6UpOtCAYFh6jL HTTP/1.1" 200 1193 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36"
192.168.0.254 - - [18/Aug/2024:09:46:33 +0000] "GET /nc/index.php/csrftoken HTTP/1.1" 200 1295 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36"
192.168.0.254 - - [18/Aug/2024:09:46:37 +0000] "GET /nc/remote.php/dav/files/KENMAN/TEST/latest.tar.bz2 HTTP/1.1" 200 4653743 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36"
192.168.0.254 - - [18/Aug/2024:09:46:43 +0000] "GET /nc/apps/richdocumentscode/proxy.php?status HTTP/1.1" 200 3043 "-" "Nextcloud Server Crawler"
192.168.0.254 - - [18/Aug/2024:09:46:43 +0000] "GET /nc/apps/richdocumentscode/proxy.php?req=/hosting/capabilities HTTP/1.1" 200 3370 "-" "Nextcloud Server Crawler"
192.168.0.254 - - [18/Aug/2024:09:46:43 +0000] "GET /nc/apps/richdocumentscode/proxy.php?status HTTP/1.1" 200 3043 "-" "Nextcloud Server Crawler"
192.168.0.254 - - [18/Aug/2024:09:46:43 +0000] "GET /nc/apps/richdocumentscode/proxy.php?req=/hosting/discovery HTTP/1.1" 200 5050 "-" "Nextcloud Server Crawler"
192.168.0.254 - - [18/Aug/2024:09:46:43 +0000] "GET /nc/ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 304 1146 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36"

It is the log file tail when I try to download “latest.tar.bz2” file at 11:46:37. The time data seems to have a 2 hours offset.

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

Erreur	no app in context	
Exception
HMAC does not match.
Could not decrypt or decode encrypted session data

"18 août 2024, 11:16:47"	

Erreur	no app in context	
Exception
HMAC does not match.
Could not decrypt or decode encrypted session data

"18 août 2024, 11:16:47"	

Erreur	PHP	
file_get_contents(/var/www/html/nc/data/appdata_ocoh62uy5quv/richdocuments/remoteData/capabilities): Failed to open stream: No such file or directory at /var/www/html/nc/lib/private/Files/Storage/Local.php#331

"18 août 2024, 11:04:36"	

Erreur	PHP	
file_get_contents(/var/www/html/nc/data/appdata_ocoh62uy5quv/richdocuments/remoteData/capabilities): Failed to open stream: No such file or directory at /var/www/html/nc/lib/private/Files/Storage/Local.php#331

"18 août 2024, 11:04:34"	

Erreur	PHP	
file_get_contents(/var/www/html/nc/data/appdata_ocoh62uy5quv/richdocuments/remoteData/capabilities): Failed to open stream: No such file or directory at /var/www/html/nc/lib/private/Files/Storage/Local.php#331

"18 août 2024, 11:04:34"	

Erreur	PHP	
unlink(/var/www/html/nc/data/appdata_ocoh62uy5quv/richdocuments/remoteData/discovery): No such file or directory at /var/www/html/nc/lib/private/Files/Storage/Local.php#348

"18 août 2024, 11:03:46"	

Erreur	PHP	
unlink(/var/www/html/nc/data/appdata_ocoh62uy5quv/richdocuments/remoteData/discovery): No such file or directory at /var/www/html/nc/lib/private/Files/Storage/Local.php#348

"18 août 2024, 11:03:44"	

Erreur	webdav	
NotFoundException
/appdata_ocoh62uy5quv/richdocuments/remoteData/capabilities

"18 août 2024, 11:03:39"	

Erreur	PHP	
file_get_contents(/var/www/html/nc/data/appdata_ocoh62uy5quv/richdocuments/remoteData/capabilities): Failed to open stream: No such file or directory at /var/www/html/nc/lib/private/Files/Storage/Local.php#331

"18 août 2024, 10:21:45"

All these error are stranges, I do not try to understand all these errors, but no error is shown when I tried to download the file at 11:46:37.

It works perfectly when I try to download from my local IP address (even 1GB files, I edit php.ini files in folders apache2, cli and fpm to manage large files), but from mydomain.xyz it fails (excepting for very small downloads like 2-3MB).

I do not find any log with usefull information about the failure.

In Chrome (or Firefox) download history, it is written:
“Download failed check your internet connexion”.

I am not sur that is correlated with my trouble but, after the complete NC installation, in the security scan of NC admin page, the following error was written:
« Your remote address was identified as “192.168.0.254” and is brute-force throttled at the moment slowing down the performance of various requests. If the remote address is not your address this can be an indication that a proxy is not configured correctly. For more details see the documentation :arrow_upper_right:.
The previous years, with previous version of NC, I do not remember to need to change this setting.
To eliminate the trouble, I do not find any other solution than adding:
192.168.0.0/24 in the withelist NC app to ignore brute force from my Internet Gateway.

Please help will be very appreciated, I spent all the evening of this week to find a solution. Firstly, I tried to tune the setting in php.ini fileds but when I discovered that it works when I am connected to my local IP, I am disappointed.

Regards

Where does your hostname resolve? Is it a public IP located on your router? Or a reverse proxy? Etc.

My domain name “mydomain.xyz” is provided by OVH.
In OVH dashboard, I configured a redirection from this domain to my internet public address.
On my Internet Box (router), I configure a NAT to redirect all traffic from 443 port (ssl) to the local IP of my APACHE2 server.
In my APACHE2 server, NC is not in the root but in the folder “nc” so I connect to my NC by the URL:
https://mydomain.xyz/nc

In APACHE2 setting, I configure a virtualhost called “mydomain.xyz.conf” with this content:

<IfModule mod_ssl.c>
<VirtualHost *:443>
     ServerAdmin anonymous@yahoo.fr
     ServerAlias mydomain.xyz
     DocumentRoot /var/www/html
     ServerName mydomain.xyz
     ErrorLog /var/log/apache2/nextcloud-error.log
     CustomLog /var/log/apache2/nextcloud-access.log combined

    <Directory /var/www/html/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
        SetEnv HOME /var/www/html/
        SetEnv HTTP_HOME /var/www/html/
    </Directory>

    <IfModule mod_headers.c>
      Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
    </IfModule>

SSLCertificateFile /etc/letsencrypt/live/mydomain.xyz-0001/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mydomain.xyz-0001/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

I prefer to precise that I am not a Linux expert, it is just a hobby

Regards