map $http_upgrade $sw2_connection_upgrade { default upgrade; '' close; } map $http_x_forwarded_proto $sw2_forwarded_proto { default $scheme; http http; https https; } server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; server_tokens off; client_max_body_size 1024m; location = /healthz { access_log off; default_type text/plain; return 200 'ok'; } location = /api { return 308 /api/; } location ^~ /api/ { proxy_pass http://sw2-backend:8000/; proxy_http_version 1.1; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $http_x_real_ip; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $sw2_forwarded_proto; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $sw2_connection_upgrade; proxy_buffering off; proxy_request_buffering off; proxy_read_timeout 600s; proxy_send_timeout 600s; } location ~ /\. { return 404; } location / { add_header Cache-Control 'no-cache'; try_files $uri $uri/ /index.html; } }