Docker: Unable to upload files > 1MB via Web Interface

Created on 29 Jul 2018  路  5Comments  路  Source: nextcloud/docker

Three days ago my nextcloud container was updated to Nextcloud 13.0.5. Since then I am unable to upload files > 1MB via the Web Interface.

To reproduce the error I created two files with dd:

dd if=/dev/zero of=upload_test_1024kb bs=1024k count=1
dd if=/dev/zero of=upload_test_1025kb bs=1025k count=1

Uploading the first file (upload_test_1024kb) works without problems. Uploading the second file (upload_test_1025kb) shows an infinite status bar stating that upload will take "a few seconds". The behaviour is the same using drag&drop functionality or the upload dialogue.

I tried different browsers and systems (Debian Stretch with Firefox, MacOS with Safari, MacOS with Firefox) but the error remains the same.

The Nextcloud event log does not show any errors.

Uploading files (even images with 5MB) works fine using the Android Nextcloud App so the error seems to be limited to the web interface.

For your reference this is the extract from my docker-compose.yml file:

  www-nextcloud:
    container_name: www-nextcloud
    image: nextcloud:apache
    restart: always
    volumes:
      - /mnt/Doc_Nextcloud:/var/www/html
    environment:
      - VIRTUAL_HOST=nextcloud.abc.eu
      - LETSENCRYPT_HOST=nextcloud.abc.eu
      - [email protected]
      - MYSQL_HOST=db
    env_file:
      - db.env
    depends_on:
      - db
      - www-collabora
    networks:
      - proxy-tier
      - default

The folder containing all data (/mnt/Doc_Nextcloud) is located on a NAS and mounted via CIFS (Samba).

Most helpful comment

I found the issue.
The issue is not in the nextcloud container, but in the jwilder/nginx-proxy.

Just set your own file limit (like 1gb) in your own Dockerfile.

FROM jwilder/nginx-proxy
RUN { \
    echo 'client_max_body_size 1g;'; \
    } > /etc/nginx/conf.d/my_proxy.conf

It is documented on github.com/jwilder/nginx-proxy

All 5 comments

can you post the rest of the docker-compose.yml file, especially the reverse proxy part

Sure. Here it is:

docker-compose.yml:

version: '2'

services:

  db:
    container_name: www-db
    image: mariadb
    build: ./db
    restart: always
    volumes:
      - /opt/docker_data/www-db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD='...'
    env_file:
      - db.env

  www-nextcloud:
    container_name: www-nextcloud
    image: nextcloud:apache
    restart: always
    volumes:
      - /mnt/Doc_Nextcloud:/var/www/html
    environment:
      - VIRTUAL_HOST=nextcloud.abc.eu
      - LETSENCRYPT_HOST=nextcloud.abc.eu
      - [email protected]
      - MYSQL_HOST=db
    env_file:
      - db.env
    depends_on:
      - db
      - www-collabora
    networks:
      - proxy-tier
      - default

  www-webtrees:
    container_name: www-webtrees
    build: ./webtrees
    restart: always
    volumes:
      - /opt/docker_data/www-webtrees_data:/var/www/html/data
    labels:
      - com.centurylinklabs.watchtower.enable="false"
    environment:
      - VIRTUAL_HOST=stammbaum.abc.eu
      - LETSENCRYPT_HOST=stammbaum.abc.eu
      - [email protected]
    depends_on:
      - db
    networks:
      - proxy-tier
      - default

  www-roundcube:
    container_name: www-roundcube
    build: ./roundcube
    restart: always
    volumes:
      - /opt/docker_data/www-roundcube:/var/www/html/plugins/enigma/home
    labels:
      - com.centurylinklabs.watchtower.enable="false"
    environment:
      - VIRTUAL_HOST=roundcube.abc.eu
      - LETSENCRYPT_HOST=roundcube.abc.eu
      - [email protected]
    dns:
      - 192.168.17.1
    depends_on:
      - db
    networks:
      - proxy-tier
      - default

  www-collabora:
    container_name: www-collabora
    image: collabora/code
    restart: always
    expose:
      - 9980
    cap_add:
      - MKNOD
    environment:
      - VIRTUAL_HOST=office.abc.eu
      - VIRTUAL_NETWORK=proxy-tier
      - VIRTUAL_PORT=9980
      - VIRTUAL_PROTO=https
      - LETSENCRYPT_HOST=office.abc.eu
      - [email protected]
      - domain=nextcloud.abc.eu
    networks:
      - proxy-tier

  proxy:
    container_name: www-nginxproxy
    image: jwilder/nginx-proxy:alpine
    build: ./proxy
    restart: always
    ports:
      - 80:80
      - 443:443
    environment:
      DEFAULT_HOST: pihole.abc.eu
    labels:
      com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
    volumes:
      - /opt/docker_data/www-nginxproxy/certs:/etc/nginx/certs:ro
      - /opt/docker_data/www-nginxproxy/vhosts:/etc/nginx/vhost.d
      - /opt/docker_data/www-nginxproxy/html:/usr/share/nginx/html
      - /var/run/docker.sock:/tmp/docker.sock:ro
    networks:
      - proxy-tier

  letsencrypt-companion:
    container_name: www-nginxproxy_comp
    image: jrcs/letsencrypt-nginx-proxy-companion
    restart: always
    volumes:
      - /opt/docker_data/www-nginxproxy/certs:/etc/nginx/certs
      - /opt/docker_data/www-nginxproxy/vhosts:/etc/nginx/vhost.d
      - /opt/docker_data/www-nginxproxy/html:/usr/share/nginx/html
      - /var/run/docker.sock:/var/run/docker.sock:ro
    networks:
      - proxy-tier
    depends_on:
      - proxy

networks:
  proxy-tier:

I updated my docker container as well and came across this issue.
When uploading via WebDAV there is also the 1MB file size limit.
Downgrading to 13.0.4 did not help,
Downgrading to 13.0.3 did not work

I found the issue.
The issue is not in the nextcloud container, but in the jwilder/nginx-proxy.

Just set your own file limit (like 1gb) in your own Dockerfile.

FROM jwilder/nginx-proxy
RUN { \
    echo 'client_max_body_size 1g;'; \
    } > /etc/nginx/conf.d/my_proxy.conf

It is documented on github.com/jwilder/nginx-proxy

Great! Thanks for the hint.

As I am using Watchtower I try to avoid Dockerfiles since it does not automatically update these containers. Therefore I created a single-line config file and mounted it to the Nginx container.

Config file on host (/opt/docker_data/www-nginxproxy/conf.d/my_proxy.conf):
client_max_body_size 1g;

New section in docker-compose.yml:

(...)
 proxy:
    container_name: www-nginxproxy
    image: jwilder/nginx-proxy:alpine
    build: ./proxy
    restart: always
    ports:
      - 80:80
      - 443:443
    environment:
      DEFAULT_HOST: <DOMAIN>
    labels:
      com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
    volumes:
      - /opt/docker_data/www-nginxproxy/certs:/etc/nginx/certs:ro
      - /opt/docker_data/www-nginxproxy/vhosts:/etc/nginx/vhost.d
      - /opt/docker_data/www-nginxproxy/html:/usr/share/nginx/html
      - /opt/docker_data/conf.d/my_proxy.conf:/etc/nginx/conf.d/my_proxy.conf:ro
      - /var/run/docker.sock:/tmp/docker.sock:ro
    networks:
      - proxy-tier
(...)
Was this page helpful?
0 / 5 - 0 ratings