Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions server-ce/init_scripts/200_nginx_config_template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ if [ -f "${nginx_template_file}" ]; then
export NGINX_KEEPALIVE_TIMEOUT="${NGINX_KEEPALIVE_TIMEOUT:-65}"
export NGINX_WORKER_CONNECTIONS="${NGINX_WORKER_CONNECTIONS:-768}"
export NGINX_WORKER_PROCESSES="${NGINX_WORKER_PROCESSES:-4}"
export MAX_UPLOAD_SIZE_NGINX="${MAX_UPLOAD_SIZE:-50}m"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Normalize MAX_UPLOAD_SIZE before building Nginx size

MAX_UPLOAD_SIZE_NGINX is built by blindly appending m to MAX_UPLOAD_SIZE, so values that the web config currently accepts via parseInt (for example MAX_UPLOAD_SIZE=100m or 100MB) become invalid Nginx sizes like 100mm/100MBm. In that case nginx -t in this script fails and the container cannot finish startup, even though the JS side still interprets the same env var as 100 MB. This introduces a parser mismatch between services/web/config/settings.defaults.js and the Nginx templating path.

Useful? React with 👍 / 👎.


echo "Nginx: generating config file from template"

Expand All @@ -31,6 +32,7 @@ if [ -f "${nginx_template_file}" ]; then
${NGINX_KEEPALIVE_TIMEOUT}
${NGINX_WORKER_CONNECTIONS}
${NGINX_WORKER_PROCESSES}
${MAX_UPLOAD_SIZE_NGINX}
' \
< "${nginx_template_file}" \
> "${nginx_config_file}"
Expand Down
2 changes: 1 addition & 1 deletion server-ce/nginx/nginx.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ http {
gzip_disable "msie6";
gzip_proxied any; # allow upstream server to compress.

client_max_body_size 50m;
client_max_body_size ${MAX_UPLOAD_SIZE_NGINX};

# gzip_vary on;
# gzip_proxied any;
Expand Down
4 changes: 2 additions & 2 deletions services/web/config/settings.defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ module.exports = {
process.env.PROJECT_UPLOAD_TIMEOUT || '120000',
10
),
maxUploadSize: 50 * 1024 * 1024, // 50 MB
maxUploadSize: parseInt(process.env.MAX_UPLOAD_SIZE || '50', 10) * 1024 * 1024, // MB
multerOptions: {
preservePath: process.env.MULTER_PRESERVE_PATH,
},
Expand Down Expand Up @@ -1154,4 +1154,4 @@ module.exports.oauthProviders = {
linkPath: '/oidc/login',
},
}),
}
}