server {
    listen 3000;
    server_name _;
    root /opt/blockchain-explorer;
    index index.html;
    
    # API proxy - standardize endpoints
    location /api/v1/ {
        proxy_pass http://localhost:8082/rpc/;
        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;
    }
    
    # Legacy API compatibility
    location /rpc {
        return 307 /api/v1$uri?$args;
    }
    
    # Static files
    location /assets/ {
        expires 1y;
        add_header Cache-Control "public, immutable";
    }
    
    # SPA fallback
    location / {
        try_files $uri $uri/ /index.html;
    }
}
