fix: nginx proxy buffering warnings and LOG_LEVEL propagation (#229)
- Increase proxy buffer sizes to prevent upstream image responses being buffered to temporary files (16k header + 8x256k body + 512k busy) - Add env_file to frontend service in docker-compose.dev.yml for LOG_LEVEL - Normalize LOG_LEVEL in nginx-entrypoint.sh (case-insensitive, trim whitespace) - Add startup logging showing LOG_LEVEL → access_log mapping Closes #226
This commit is contained in:
@@ -30,6 +30,8 @@ services:
|
||||
volumes:
|
||||
- ./frontend:/app
|
||||
- frontend_node_modules:/app/node_modules
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
- BACKEND_URL=http://backend-dev:3000
|
||||
ports:
|
||||
|
||||
@@ -8,12 +8,17 @@
|
||||
# LOG_LEVEL=warn|error|fatal|silent → access logs suppressed
|
||||
# =============================================================================
|
||||
|
||||
case "${LOG_LEVEL:-info}" in
|
||||
# Normalize: lowercase + trim whitespace
|
||||
level=$(printf '%s' "${LOG_LEVEL:-info}" | tr '[:upper:]' '[:lower:]' | tr -d '[:space:]')
|
||||
|
||||
case "$level" in
|
||||
warn|error|fatal|silent)
|
||||
export NGINX_ACCESS_LOG="off"
|
||||
echo "[nginx-entrypoint] LOG_LEVEL=${LOG_LEVEL} → access_log off"
|
||||
;;
|
||||
*)
|
||||
export NGINX_ACCESS_LOG="/dev/stdout"
|
||||
echo "[nginx-entrypoint] LOG_LEVEL=${LOG_LEVEL:-info} → access_log /dev/stdout"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
@@ -43,5 +43,11 @@ server {
|
||||
# Timeout for uploads
|
||||
proxy_read_timeout 60s;
|
||||
proxy_send_timeout 60s;
|
||||
|
||||
# Increase proxy buffers to avoid buffering images/responses to temp files
|
||||
# Default is 8 x 4k/8k which is too small for medication images
|
||||
proxy_buffer_size 16k;
|
||||
proxy_buffers 8 256k;
|
||||
proxy_busy_buffers_size 512k;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user