Skip to content

Commit

Permalink
attempt nginx fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedkhaleel2004 committed Feb 14, 2025
1 parent 4f1834f commit 582adbe
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion backend/nginx/api.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ server {
proxy_buffering off;
proxy_cache off;
proxy_http_version 1.1;
proxy_set_header Connection '';

# Update connection header handling
proxy_set_header Connection ''; # Keep this empty for HTTP/1.1 chunked transfer
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
Expand All @@ -38,6 +40,12 @@ server {
# Keep connection alive
keepalive_timeout 300s;
keepalive_requests 1000;

# Add these new settings
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400s; # 24 hours - prevent timeout during long streams
client_max_body_size 10M; # Increase if needed
}

# Return 444 for everything else (no response, just close connection)
Expand All @@ -52,6 +60,9 @@ server {
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

# Add this at the server level (outside location blocks)
client_header_timeout 300s;
client_body_timeout 300s;
}
server {
if ($host = api.gitdiagram.com) {
Expand Down

0 comments on commit 582adbe

Please sign in to comment.