From be0d7ed5bc31c6b1b2cae232a2c5675bfa32c4b1 Mon Sep 17 00:00:00 2001 From: Kruemmelspalter Date: Mon, 9 Jan 2023 14:52:41 +0100 Subject: [PATCH] set max file sizes (#47) * set max file size for nginx to 1024M * set spring max file/request size * set client max file size --- .../file_spider/backend/FileSpiderApplication.kt | 10 ++++++++-- client/index.js | 2 +- nginx.conf | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/backend/app/src/main/kotlin/me/kruemmelspalter/file_spider/backend/FileSpiderApplication.kt b/backend/app/src/main/kotlin/me/kruemmelspalter/file_spider/backend/FileSpiderApplication.kt index 03c7f08..baa7904 100644 --- a/backend/app/src/main/kotlin/me/kruemmelspalter/file_spider/backend/FileSpiderApplication.kt +++ b/backend/app/src/main/kotlin/me/kruemmelspalter/file_spider/backend/FileSpiderApplication.kt @@ -5,14 +5,15 @@ import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.autoconfigure.SpringBootApplication import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration +import org.springframework.boot.builder.SpringApplicationBuilder import org.springframework.boot.context.event.ApplicationReadyEvent -import org.springframework.boot.runApplication import org.springframework.context.annotation.Bean import org.springframework.context.event.EventListener import org.springframework.core.io.ClassPathResource import org.springframework.jdbc.core.JdbcTemplate import org.springframework.jdbc.datasource.init.ScriptUtils import org.springframework.web.servlet.DispatcherServlet +import java.util.Properties import javax.sql.DataSource @SpringBootApplication @@ -55,5 +56,10 @@ class FileSpiderApplication { } fun main(args: Array) { - runApplication(*args) + val props = Properties() + + props["spring.servlet.multipart.max-file-size"] = "1024MB" + props["spring.servlet.multipart.max-request-size"] = "1024MB" + + SpringApplicationBuilder(FileSpiderApplication::class.java).properties(props).run(*args) } diff --git a/client/index.js b/client/index.js index 8345c7f..090d33d 100644 --- a/client/index.js +++ b/client/index.js @@ -47,7 +47,7 @@ app.post('/document/:docId/edit', async (req, res) => { res.send() }) -app.use('/', proxy(API_HOST)) +app.use('/', proxy(API_HOST, { limit: '1024mb' })) var server async function startServer() { diff --git a/nginx.conf b/nginx.conf index d732c71..046a0ca 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,5 +1,7 @@ server { listen 80; + client_max_body_size 1024M; + location / { proxy_pass 'http://filespider/'; proxy_no_cache on;