Cannot sync large files ( >1 GB) to Nextcloud

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
  • Web server and version (e.g, Apache 2.4.25):
    • Apache 2.4.62
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • Traefik 2.9.10
  • PHP version (e.g, 8.3):
    • 8.2.25
  • Is this the first time you’ve seen this error? (Yes / No):
    • Yes
  • When did this problem seem to first start?
    • When I tried top sync a 2GB video file from PhotoSync App
  • Installation method (e.g. AIO, NCP, Bare Metal/Archive, etc.)
    • Docker Compose
  • Are you using Cloudflare, mod_security, or similar? (Yes / No)
    • No

Summary of the issue you are facing:

I am trying to enable large file upload/sync to my Nextcloud server, which is behind a Traefik reverse proxy. Can´t quite get it working, and would appreciate som help. Not super well versed in docker, and even less so in Traefik.
I still get the 413: Request Too Large error.
Here´s what I´ve done so far, with a little help from google, forum posts, etc.

First I set set Memory limit and Upload max size for the Nextcloud container this way:

PHP_MEMORY_LIMIT: 2G
      PHP_UPLOAD_LIMIT: 16G

Reflected in the Syatem section in the UI:

It still didn´t work, and I found out that I also have to adjust Traefik to allow large files. So I added these labels to my Nextcloud container:

 - "traefik.http.routers.nextcloud.middlewares=limit"
      - "traefik.http.middlewares.limit.buffering.maxRequestBodyBytes=10737418240"
      - "traefik.http.middlewares.limit.buffering.memRequestBodyBytes=200000000"
      - "traefik.http.middlewares.limit.buffering.maxResponseBodyBytes=10737418240"
      - "traefik.http.middlewares.limit.buffering.memResponseBodyBytes=200000000"

The ´limit´middleware shows up in Traefik:

But I can´t get it applied to the entroypint or service. I think it should show up here, as a middleware to work, am I correct?

How can I acheive that? Or should I be doing something completely different?

I also set the chunk size to 50mb, inside the Nextcloud container:

php occ config:app:set files max_chunk_size --value 52428800

What am I missing? I can of course post my whole yaml for nextcloud / traefik / collabora, but I thought I might start with the most relevant parts.

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

Not really relevant. See above, I guess.

Log entries

BadRequest
Expected filesize of 3627216900 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 0 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.
#### 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.

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.

PASTE

Web server / Reverse Proxy

Can´t find anything relevant.

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!):

www-data@8c9fe4fc3408:~/html$ ./occ config:list system
{
    "system": {
        "htaccess.RewriteBase": "\/",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "overwritehost": "http://cloud.example.com",
        "overwriteprotocol": "https",
        "overwrite.cli.url": "https:\/\/cloud.example.com",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "upgrade.disable-web": true,
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "http://cloud.example.com"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "30.0.2.2",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "default_phone_region": "SE",
        "maintenance_window_start": 3,
        "loglevel": 2,
        "maintenance": false,
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_sendmailmode": "smtp",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***"
    }
}

Apps

The output of occ app:list (if possible).

www-data@8c9fe4fc3408:~/html$ ./occ app:list
Enabled:
  - activity: 3.0.0
  - app_api: 4.0.0
  - bruteforcesettings: 3.0.0
  - circles: 30.0.0
  - cloud_federation_api: 1.13.0
  - comments: 1.20.1
  - contactsinteraction: 1.11.0
  - dashboard: 7.10.0
  - dav: 1.31.1
  - federatedfilesharing: 1.20.0
  - federation: 1.20.0
  - files: 2.2.0
  - files_downloadlimit: 3.0.0
  - files_pdfviewer: 3.0.0
  - files_reminders: 1.3.0
  - files_sharing: 1.22.0
  - files_trashbin: 1.20.1
  - files_versions: 1.23.0
  - firstrunwizard: 3.0.0
  - logreader: 3.0.0
  - lookup_server_connector: 1.18.0
  - nextcloud_announcements: 2.0.0
  - notifications: 3.0.0
  - oauth2: 1.18.1
  - password_policy: 2.0.0
  - photos: 3.0.2
  - privacy: 2.0.0
  - provisioning_api: 1.20.0
  - recommendations: 3.0.0
  - related_resources: 1.5.0
  - richdocuments: 8.5.2
  - serverinfo: 2.0.0
  - settings: 1.13.0
  - sharebymail: 1.20.0
  - support: 2.0.0
  - systemtags: 1.20.0
  - text: 4.1.0
  - theming: 2.5.0
  - twofactor_backupcodes: 1.19.0
  - updatenotification: 1.20.0
  - user_status: 1.10.0
  - viewer: 3.0.0
  - weather_status: 1.10.0
  - webhook_listeners: 1.1.0-dev
  - workflowengine: 2.12.0
Disabled:
  - admin_audit: 1.20.0
  - encryption: 2.18.0
  - files_external: 1.22.0
  - survey_client: 2.0.0 (installed 2.0.0)
  - suspicious_login: 8.0.0
  - twofactor_nextcloud_notification: 4.0.0
  - twofactor_totp: 12.0.0-dev
  - user_ldap: 1.21.0
  - whiteboard: 1.0.4 (installed 1.0.4)

Tips for increasing the likelihood of a response

  • Use the preformatted text formatting option in the editor for all log entries and configuration output.
  • If screenshots are useful, feel free to include them.
    • If possible, also include key error output in text form so it can be searched for.
  • Try to edit log output only minimally (if at all) so that it can be ran through analyzers / formatters by those trying to help you.

I have made some progress, but not quite all the way yet.

First off, I managed to apply the limit middleware, along with my hsts one, to the service by doing this:

      - "traefik.http.routers.nextcloud.middlewares=limit@docker,nextcloudHeader"

So, now when I try to sync a file (2.1 GB), the sync progress bar reaches 100%, sits there for a few seconds, and the returns the same error.

I get the same erro in the Nextcloud log:

BadRequest
Expected filesize of 2044584399 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 0 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.

I setup the access log in Traefik, and I get one row in there at the same time, which is basically saying the same thing:

192.168.32.1 - - [06/Dec/2024:07:19:17 +0000] "PUT /remote.php/webdav/Bilder/Bilder%20iPhone/iphone%20sync/2024/11/2024-11-25_18-53-32_IMG_4072.MOV HTTP/2.0" 413 927 "-" "-" 49 "nextcloud@docker" "http://172.25.0.4:80" 61496ms

For syncing, I am using the IOS Photosync app.
And my limit middleware looks llike this now:

I´ve also tried setting the Max Request Body Bytes to 0, and the Request and Response Body Bytes to 200 mb. Still the same error. Does anyone know or have a clue to what I have missed doing?

Possibly APACHE_BODY_LIMIT. See Docker: Apache configuration.

Note that chunking isn’t applicable to your situation (unfortunately) if you’re using a third-party client app… unless it happens to support Nextcloud’s chunking method (I don’t know about PhotoSync).

That seems like it could be something. I did some more testing. I can confirm that the limit is indeed 1GB. Uploaded an 800mb file just fine, and trying a 1.1 GB file failed with the same error.

So, I am trying to set this variable. In my docker compose, I added:

APACHE_BODY_LIMIT 0

It didn´t help. And when I restart the apache service from within the Nextcloud container I get an error:
AH00111: Config variable ${APACHE_BODY_LIMIT} is not defined

It seems that the above docker line i added created a file in the container,
apache-limits.conf, in the directory /etc/apache2/conf-enabled which is a link to a file with the same name in /etc/apache2/conf-available.

echo ${APACHE_BODY_LIMIT} returns 0. Not sure what I´m doing wrong, and how I should go about this. Any clues are welcome. :slight_smile:

EDIT: it worked. Adding APACHE_BODY_LIMIT to the compose did indeed solve the problem. Trying to restart the apache service inside the container still presents the same error, but uploading my 2,5 gb video file via webdav from PhotoSync now worked.

Thank you for helping.

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.