# Internal bench UI vhost — https://bench.internal, reachable from inside
# the WireGuard mesh (the public bench.helexa.ai dead-ends at the OPNsense
# LAN interface, which only port-forwards :443 from the WAN). Same SPA +
# /api→bob proxy as bench.helexa.ai, but with an internal-CA cert
# (smallstep "lair", renewed by step@bench.timer). Mirrors the
# *.internal vhost convention on oolon.kosherinata.internal.
server {
    server_name bench.internal;
    listen 443 ssl;
    http2 on;

    ssl_certificate /etc/nginx/tls/cert/bench.internal.pem;
    ssl_certificate_key /etc/nginx/tls/key/bench.internal.pem;
    ssl_trusted_certificate /etc/pki/ca-trust/source/anchors/root-internal.pem;
    ssl_protocols TLSv1.3;

    # Shared webroot with the public vhost — same built SPA.
    root /var/www/bench.helexa.ai;
    index index.html;

    location /api/ {
        proxy_pass http://bob.hanzalova.internal:13132;
        proxy_http_version 1.1;
        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;
        proxy_read_timeout 60s;
    }

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