server {
    listen 80 default_server;
    server_name _;

    root /opt/octava-webui-next/frontend;
    index index.html;

    location / {
        add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
        expires -1;
        try_files $uri $uri/ /index.html;
    }
}

server {
    listen 8080;
    server_name _;

    root /opt/octava-webui/frontend;
    index index.html;

    # Static files
    location / {
        add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
        expires -1;
        try_files $uri $uri/ /index.html;
    }

    # Legacy comparison API proxy to uvicorn.
    location /api/ {
        proxy_pass http://unix:/run/octava-webui/webui.sock;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}
