Skip to content

Commit

Permalink
set max file sizes (#47)
Browse files Browse the repository at this point in the history
* set max file size for nginx to 1024M

* set spring max file/request size

* set client max file size
  • Loading branch information
Kruemmelspalter authored Jan 9, 2023
1 parent 4cd31f0 commit be0d7ed
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -55,5 +56,10 @@ class FileSpiderApplication {
}

fun main(args: Array<String>) {
runApplication<FileSpiderApplication>(*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)
}
2 changes: 1 addition & 1 deletion client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 2 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
server {
listen 80;
client_max_body_size 1024M;

location / {
proxy_pass 'http://filespider/';
proxy_no_cache on;
Expand Down

0 comments on commit be0d7ed

Please sign in to comment.