Sendbox / nginx.conf
RaBU1234's picture
Create nginx.conf
2fbe0e6 verified
server {
listen 7860;
server_name _;
client_max_body_size 50M;
# Main API routes
location /api/ {
proxy_pass http://localhost:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_read_timeout 300s;
proxy_connect_timeout 75s;
}
# SSE streaming endpoint - disable buffering
location ~ ^/api/sandbox/[^/]+/command/[^/]+/stream$ {
proxy_pass http://localhost:3001;
proxy_http_version 1.1;
proxy_set_header Connection '';
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 3600s;
chunked_transfer_encoding off;
}
# Dynamic port preview - proxy to internal ports
location ~ ^/preview/(d+)/(.*)$ {
proxy_pass http://localhost:$1/$2$is_args$args;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_read_timeout 300s;
}
# Health check
location /health {
proxy_pass http://localhost:3001/health;
}
# Root
location / {
proxy_pass http://localhost:3001/;
}
}