From c546e853a82ec17dc3377511494c54b055b192e8 Mon Sep 17 00:00:00 2001 From: Zoey Date: Thu, 15 Feb 2024 01:18:32 +0100 Subject: [PATCH] allow to disable proxy_buffering --- Dockerfile | 1 + compose.yaml | 1 + rootfs/usr/local/bin/start.sh | 11 +++++++++++ rootfs/usr/local/nginx/conf/nginx.conf | 5 +++++ 4 files changed, 18 insertions(+) diff --git a/Dockerfile b/Dockerfile index d8488ee9..bb51be94 100644 --- a/Dockerfile +++ b/Dockerfile @@ -124,6 +124,7 @@ ENV PUID=0 \ DISABLE_HTTP=false \ NGINX_ACCESS_LOG=false \ NGINX_LOG_NOT_FOUND=false \ + NGINX_DISABLE_PROXY_BUFFERING=false \ CLEAN=true \ FULLCLEAN=false \ SKIP_IP_RANGES=false \ diff --git a/compose.yaml b/compose.yaml index 869d8a40..fdae9d9b 100644 --- a/compose.yaml +++ b/compose.yaml @@ -31,6 +31,7 @@ services: # - "DEFAULT_CERT_ID=1" # ID of cert, which should be used instead of dummycerts, default 0/unset/dummycerts # - "DISABLE_HTTP=true" # disables nginx to listen on port 80, default false # - "NGINX_LOG_NOT_FOUND=true" # Allow logging of 404 errors, default false +# - "NGINX_DISABLE_PROXY_BUFFERING=true" # Disabled the proxy-buffering option of nginx, default false # - "CLEAN=false" # Clean folders, default true # - "FULLCLEAN=true" # Clean unused config folders, default false # - "SKIP_IP_RANGES=true" # Skip feteching/whitelisting ip ranges from aws and cloudflare, default false diff --git a/rootfs/usr/local/bin/start.sh b/rootfs/usr/local/bin/start.sh index 8bfad7f3..4ff12f46 100755 --- a/rootfs/usr/local/bin/start.sh +++ b/rootfs/usr/local/bin/start.sh @@ -136,6 +136,11 @@ if ! echo "$NGINX_LOG_NOT_FOUND" | grep -q "^true$\|^false$"; then sleep inf fi +if ! echo "$NGINX_DISABLE_PROXY_BUFFERING" | grep -q "^true$\|^false$"; then + echo "NGINX_DISABLE_PROXY_BUFFERING needs to be true or false." + sleep inf +fi + if ! echo "$CLEAN" | grep -q "^true$\|^false$"; then echo "CLEAN needs to be true or false." sleep inf @@ -735,6 +740,12 @@ else sed -i "s|log_not_found.*|log_not_found off;|g" /usr/local/nginx/conf/nginx.conf fi +if [ "$NGINX_DISABLE_PROXY_BUFFERING" = "true" ]; then + sed -i "s|proxy_buffering.*|proxy_buffering off;|g" /usr/local/nginx/conf/nginx.conf +else + sed -i "s|proxy_buffering.*|proxy_buffering on;|g" /usr/local/nginx/conf/nginx.conf +fi + if [ "$LOGROTATE" = "true" ]; then sed -i "s|access_log off; # http|access_log /data/nginx/access.log log;|g" /usr/local/nginx/conf/nginx.conf sed -i "s|access_log off; # stream|access_log /data/nginx/stream.log proxy;|g" /usr/local/nginx/conf/nginx.conf diff --git a/rootfs/usr/local/nginx/conf/nginx.conf b/rootfs/usr/local/nginx/conf/nginx.conf index 9bcaa9cd..a289b795 100644 --- a/rootfs/usr/local/nginx/conf/nginx.conf +++ b/rootfs/usr/local/nginx/conf/nginx.conf @@ -43,6 +43,11 @@ http { gunzip on; gzip_static on; + proxy_buffering on; + proxy_buffer_size 16k; + proxy_busy_buffers_size 24k; + proxy_buffers 64 4k; + http2 on; http3 on; quic_gso on;