# conf.d/*.conf is included inside http { } — map is valid here. # 不可对所有请求强行 Connection: upgrade,否则部分客户端/流式 POST 可能被错误处理。 map $http_upgrade $connection_upgrade { default upgrade; '' close; } server { listen 80; server_name localhost; client_max_body_size 100m; location / { root /usr/share/nginx/html; index index.html index.htm; try_files $uri $uri/ /index.html; } location /api/ { proxy_pass http://dataclaw-api:8000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_read_timeout 3600s; proxy_send_timeout 3600s; } location /reports/ { proxy_pass http://dataclaw-api:8000; 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; } location /agent-core/ { proxy_pass http://dataclaw-api:8000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; proxy_buffering off; proxy_read_timeout 3600s; proxy_send_timeout 3600s; } }