From b3a7090d7028f332c1c85c1fa686f06020d232ce Mon Sep 17 00:00:00 2001 From: Ondrej Kosarko Date: Tue, 16 Jan 2024 14:42:51 +0100 Subject: [PATCH] configurable client_max_body_size in /server/ location --- README.md | 5 +++++ docker-compose.yml | 2 ++ nginx/conf/templates/default.conf.template | 14 ++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/README.md b/README.md index 330565f..deeadd4 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,11 @@ NGINX_SHIBAUTHORIZER= NGINX_SHIBRESPONDER= ``` +The dspace backend location has a configurable `client_max_body_size` via +``` +NGINX_MAX_BODY_SIZE +``` + Nginx by default logs to stdout/stderr and syslog (provided by fluent-bit image). The syslog entries are written into the `logs` volume. ## additional configs for shibboleth diff --git a/docker-compose.yml b/docker-compose.yml index bd25e9c..ea2239d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,6 +19,8 @@ services: - NGINX_NODE - NGINX_SERVER_NAMES - NGINX_RESOLVERS + # this configures client_max_body_size only for the repository /server location + - NGINX_MAX_BODY_SIZE=${NGINX_MAX_BODY_SIZE:-10G} depends_on: - shibboleth diff --git a/nginx/conf/templates/default.conf.template b/nginx/conf/templates/default.conf.template index 623ea1b..02ca849 100644 --- a/nginx/conf/templates/default.conf.template +++ b/nginx/conf/templates/default.conf.template @@ -12,6 +12,19 @@ upstream node { server ${NGINX_NODE}; } +# set client body size to 512M # +client_max_body_size 512M; + +# Sets buffer size for reading client request body. In case the request body is larger than the buffer, +# the whole body or only its part is written to a temporary file. By default, buffer size is equal to two memory pages. +client_body_buffer_size 256k; + +# Defines a timeout for reading client request body. The timeout is set only for a period between two successive read +# operations, not for the transmission of the whole request body. +client_body_timeout 5s; +# Defines a timeout for reading client request header. +client_header_timeout 5s; + server { error_log /var/log/nginx/error.log notice; access_log /var/log/nginx/access.log main; @@ -60,6 +73,7 @@ server { location /server/ { include proxy_params; + client_max_body_size ${NGINX_MAX_BODY_SIZE}; proxy_pass http://tomcat; }