From 5028a28255ea9688f1484d894923d27a2556b00d Mon Sep 17 00:00:00 2001 From: H1ghSyst3m <60105043+H1ghSyst3m@users.noreply.github.com> Date: Fri, 26 Sep 2025 09:00:39 +0200 Subject: [PATCH] NGINX WebSocket and Proxy Improvements (#170) --- community/scripts/ubuntu-debian.sh | 33 ++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/community/scripts/ubuntu-debian.sh b/community/scripts/ubuntu-debian.sh index e9ff6f7..798d95e 100644 --- a/community/scripts/ubuntu-debian.sh +++ b/community/scripts/ubuntu-debian.sh @@ -571,34 +571,55 @@ echo -e "${AQUA}\n==================================================${NC}" # Configure NGINX without SSL echo -e "${YELLOW}Configuring NGINX without SSL...${NC}" cat < /etc/nginx/sites-available/${DOMAIN}-neko-rooms.conf +map \$http_upgrade \$connection_upgrade { + default upgrade; + '' close; +} + server { listen 80; server_name ${DOMAIN}; - location / { + location ^~ /${PATH_PREFIX}/ { proxy_pass http://127.0.0.1:${DOCKER_PORT}; proxy_set_header Host \$host; proxy_http_version 1.1; # WebSocket headers proxy_set_header Upgrade \$http_upgrade; - proxy_set_header Connection "upgrade"; + proxy_set_header Connection \$connection_upgrade; # Forwarding headers for reverse proxy proxy_set_header X-Real-IP \$remote_addr; proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto \$scheme; - proxy_cache_bypass \$http_upgrade; - proxy_buffering off; - proxy_read_timeout 900s; + proxy_connect_timeout 60s; + proxy_send_timeout 4h; + proxy_read_timeout 4h; + send_timeout 900s; + + proxy_request_buffering off; + proxy_buffering off; } # Admin Panel Restricted Access - location ~ ^/$ { + location / { auth_basic "Restricted Access"; auth_basic_user_file /etc/nginx/.htpasswd; + proxy_pass http://127.0.0.1:${DOCKER_PORT}; + proxy_set_header Host \$host; + proxy_http_version 1.1; + + # Falls das Admin-UI WebSockets nutzt, sind wir vorbereitet + proxy_set_header Upgrade \$http_upgrade; + proxy_set_header Connection \$connection_upgrade; + + # Forwarding headers wie oben + proxy_set_header X-Real-IP \$remote_addr; + proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto \$scheme; } } EOF