events {}
http {
    include mime.types;

    server {
        listen 8280;
        access_log /dev/null;
        error_log /dev/null;

        # Forward backend API/proxy calls so absolute frontend-host URLs in
        # manifests (e.g. /proxy/stream/sub/...) continue to work.
        location /api/ {
            proxy_pass http://safetwitch-backend:7000/api/;
            proxy_http_version 1.1;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
        }

        location /proxy/ {
            proxy_pass http://safetwitch-backend:7000/proxy/;
            proxy_http_version 1.1;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
        }

        location / {
            root /app;
            index index.html;
            try_files $uri $uri/ /index.html;
        }
    }
}