server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Bunny uploads pass through this reverse proxy. Keep the same 5 GB ceiling # as the API default and stream bodies instead of buffering them on disk. client_max_body_size 5g; gzip on; gzip_min_length 1024; gzip_types text/plain text/css application/json application/javascript application/xml image/svg+xml; add_header X-Content-Type-Options "nosniff" always; add_header X-Frame-Options "SAMEORIGIN" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always; add_header Strict-Transport-Security "max-age=31536000" always; location /assets/ { try_files $uri =404; expires 1y; } # Docker Swarm may start this container before the API service receives a DNS # record. Resolving through Docker DNS at request time keeps Nginx alive while # the API starts or is replaced during a rolling deployment. resolver 127.0.0.11 ipv6=off valid=10s; resolver_timeout 5s; set $api_upstream api; location /api/ { proxy_pass http://$api_upstream:3001; proxy_http_version 1.1; proxy_request_buffering off; proxy_buffering off; proxy_read_timeout 3600s; proxy_send_timeout 3600s; 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 / { try_files $uri $uri/ /index.html; } }