map $http_upgrade $connection_upgrade { default upgrade; '' close; } server { listen 80; listen [::]:80; server_name _; root /usr/share/nginx/html; index index.html; # Matches the default API allowance of twenty 25 MiB files plus multipart # overhead. Keep this in sync if the backend upload limits are raised. client_max_body_size 512m; resolver 127.0.0.11 valid=10s ipv6=off; set $api_origin http://api:7532; location ~ ^/(api|health|media)(/|$) { proxy_pass $api_origin; proxy_http_version 1.1; proxy_connect_timeout 5s; # Multipart requests return only after image processing and private-S3 # writes complete. This is an inactivity timeout, not a size limit. proxy_read_timeout 10m; proxy_send_timeout 10m; 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; } location /socket.io/ { proxy_pass $api_origin; 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_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_buffering off; proxy_read_timeout 75s; } location / { try_files $uri $uri/ /index.html; } }