From 6a0ef7a1c19546304eaf6dc811397fc8a8c0fcfa Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Sun, 20 Aug 2017 19:00:00 -0700 Subject: [PATCH] Allow larger files to be uploaded Note that other upload APIs like avatar are still limited to 1m by the nginx config --- setup/start/nginx/appconfig.ejs | 8 +++++--- src/server.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/setup/start/nginx/appconfig.ejs b/setup/start/nginx/appconfig.ejs index 170c61950..76d3fd164 100644 --- a/setup/start/nginx/appconfig.ejs +++ b/setup/start/nginx/appconfig.ejs @@ -80,9 +80,6 @@ server { # No buffering to temp files, it fails for large downloads proxy_max_temp_file_size 0; - # Disable check to allow unlimited body sizes - client_max_body_size 0; - <% if (robotsTxtQuoted) { %> location = /robots.txt { return 200 <%- robotsTxtQuoted %>; @@ -107,6 +104,11 @@ server { proxy_read_timeout 30m; } + location ~ ^/api/v1/apps/.*/upload$ { + proxy_pass http://127.0.0.1:3000; + client_max_body_size 0; + } + # graphite paths (uncomment block below and visit /graphite/index.html) # location ~ ^/(graphite|content|metrics|dashboard|render|browser|composer)/ { # proxy_pass http://127.0.0.1:8000; diff --git a/src/server.js b/src/server.js index 95916ba2f..f5c6766e1 100644 --- a/src/server.js +++ b/src/server.js @@ -81,7 +81,7 @@ function initializeExpressSync() { .use(middleware.lastMile()); // NOTE: these limits have to be in sync with nginx limits - var FILE_SIZE_LIMIT = '1mb', // max file size that can be uploaded (see also client_max_body_size in nginx) + var FILE_SIZE_LIMIT = '256mb', // max file size that can be uploaded (see also client_max_body_size in nginx) FILE_TIMEOUT = 60 * 1000; // increased timeout for file uploads (1 min) var multipart = middleware.multipart({ maxFieldsSize: FIELD_LIMIT, limit: FILE_SIZE_LIMIT, timeout: FILE_TIMEOUT });