server { listen 80; server_name _; root /usr/share/nginx/html; client_max_body_size 50m; gzip on; gzip_types text/css application/javascript application/json image/svg+xml; # Docker DNS, so a recreated backend container is picked up without an nginx reload. resolver 127.0.0.11 valid=30s ipv6=off; location /api/ { set $backend_upstream backend:5670; proxy_pass http://$backend_upstream$request_uri; proxy_http_version 1.1; proxy_set_header Host $host; 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; # Variable proxy_pass plus keepalive reuses a socket that is still # writing SSE. The next chat is written onto that socket and both die. proxy_set_header Connection "close"; proxy_buffering off; proxy_cache off; proxy_read_timeout 3600s; proxy_send_timeout 3600s; } location /files/ { set $backend_upstream backend:5670; proxy_pass http://$backend_upstream$request_uri; proxy_http_version 1.1; proxy_set_header Host $host; 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_buffering off; proxy_read_timeout 3600s; } location /images/ { set $backend_upstream backend:5670; proxy_pass http://$backend_upstream$request_uri; proxy_http_version 1.1; proxy_set_header Host $host; 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_buffering off; } location /health/ { set $backend_upstream backend:5670; proxy_pass http://$backend_upstream$request_uri; proxy_http_version 1.1; proxy_set_header Host $host; } location / { try_files $uri $uri/ /index.html; } }