[SOLVED] Nextcloud android app error "Upload failed - Payload Too Large"

In case this can help someone out (my first post :slight_smile: ) :

Nextcloud server:

Nextcloud version: Nextcloud Hub 6 27.1.4
Operating system and version: Ubuntu 22.04.3 LTS
Apache version: 2.4.52
PHP version: 8.1.2-1ubuntu2.14

Nginx reverse-proxy server:

Operating system and version: Ubuntu 22.04.3 LTS
Nginx version:1.25.3

Context: Domain name proxied through cloudflared to my homelab. Ports 80 and 443 forwared to nginx reverse-proxy server. Nextcloud server hosted behind reverse-proxy.

The issue:

Taking pictures on my android phone everything uploads/syncs through the nextcloud app correctly only when I am on my home nextwork. When I am outside my home network (or when using VPN) I get the error message through my notifications: “Upload failed - Payload Too Large”

No error messages on nextcloud host, therefore error probably originates upstream of nextcloud/php server. Just to be safe and thorough I still opted to adjust php.ini as described. Nginx error logs ( /var/log/nginx/error.log):

client intended to send too large body: 2779819 bytes, client: x.x.x.x, server: youserver.domain, request: “PUT /remote.php/dav/files/…/475.jpg HTTP/1.1”, host: youdomain

Steps taken (thank you chatgpt):

On nextcloud host:
locate php.ini file ( /etc/php/8.1/cli/php.ini)
change the following directives (adjust to your needs):

upload_max_filesize = 128M
post_max_size = 128M

restart Apache

sudo service apache2 restart

or

sudo systemctl restart apache2

On nginx reverse-proxy server:
Open nextcloud config file. Location will depend on your configuration. Mine is located in /etc/nginx/conf.d/sites-available/nextcloud.conf
Under server block:

server {
    # ... other configuration options

    client_max_body_size 128M; # Adjust the value according to your needs

    # ... other configuration options

Test nginx conf

sudo nginx -t

Restart nginx

sudo service nginx restart

Restart nextcloud app to force re-upload of the error-generated file.
Issue fixed; able to upload through VPN and when outside network. Also confirmed with empty log files on nginx server.

1 Like

hi @Jayef welcome to the forum :handshake:

thank you for valuable first post. here is the official doc for this topic

https://docs.nextcloud.com/server/stable/admin_manual/configuration_files/big_file_upload_configuration.html

Hi @wwe

Great, thanks for the info, I’ll look into that.