# ULTRA_LICENSE_DOMAIN must be the owner's real DNS hostname, without https://.
# Set both hostnames in the caddy systemd environment after DNS is configured.
# See aliyun.env.example for the selected domain; this is not yet deployed.
{$ULTRA_LICENSE_DOMAIN} {
    header X-Content-Type-Options nosniff
    header Referrer-Policy no-referrer

    @authorization path /health /v1/activate /v1/refresh
    handle @authorization {
        reverse_proxy 127.0.0.1:18765
    }

    # Copy only public APKs and their corresponding source archives here.
    handle /downloads/* {
        root * /srv/quehun-ultra-public
        file_server
    }

    respond "Not Found" 404
}

{$ULTRA_DOWNLOAD_DOMAIN} {
    header X-Content-Type-Options nosniff
    header Referrer-Policy no-referrer
    root * /srv/quehun-ultra-public
    file_server
}
