server {
    listen 80;
    root /usr/share/nginx/html;

    resolver 127.0.0.11 valid=10s ipv6=off;

    location ~* \.(html)$ {
        add_header Cache-Control "no-cache, no-store, must-revalidate";
        try_files $uri =404;
    }

    location / {
        add_header Cache-Control "no-cache, no-store, must-revalidate";
        try_files $uri $uri/ /index.html;
    }

    location = /api/health {
        set $upstream api;
        proxy_pass http://$upstream:8080/health;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }

    location /api/ {
        set $upstream api;
        proxy_pass http://$upstream:8080$request_uri;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_connect_timeout 30s;
        proxy_send_timeout 600s;
        proxy_read_timeout 600s;
        proxy_buffering off;
        proxy_cache off;
    }
}
