server {
    listen 80;
    server_name _;

    root /usr/share/nginx/html;
    index index.html;

    # Ensure directory redirects are relative to preserve https behind Fly proxy
    absolute_redirect off;
    port_in_redirect off;

    # Disable caching for docs responses to avoid stale redirects.
    add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0" always;
    add_header Pragma "no-cache" always;
    add_header Expires "0" always;

    # Keep introduction route local and normalized.
    location = /introduction {
        return 301 /introduction/;
    }

    # Defensive cache busting for stale client-side redirects on docs entrypoint.
    location = /introduction/ {
        add_header Clear-Site-Data "\"cache\"" always;
        try_files /introduction/index.html =404;
    }

    location / {
        try_files $uri $uri/ =404;
    }
}
