{
    default_sni 143.20.50.6
    auto_https disable_redirects
    admin off
}

(kordyx-download-portal) {
    encode zstd gzip
    header X-Content-Type-Options nosniff
    header Referrer-Policy no-referrer
    header Link "</source/>; rel=\"license\""
    redir /status /status/ 308
    handle_path /status/* {
        root * /srv/status
        header Content-Security-Policy "default-src 'self'; img-src 'self'; style-src 'self'; font-src 'self'; script-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'"
        header /status.json Cache-Control "no-store"
        file_server
    }
    handle /healthz {
        respond "ok" 200
    }
    redir /source /source/ 308
    redir / https://kordyx.xyz/download/ 302
    redir /downloads https://kordyx.xyz/download/ 302
    redir /downloads/ https://kordyx.xyz/download/ 302
    handle_path /source/* {
        root * /srv/source
        file_server
    }
    handle_path /downloads/* {
        @installers path /Kordia-Android-arm64.apk /Kordia-Android-armv7.apk /Kordia-Android-x86_64.apk /SHA256SUMS /kordyx-background.png /kordyx-transparent.png
        handle @installers {
            root * /srv/downloads
            file_server
        }
        handle {
            respond "Not found" 404
        }
    }
    handle {
        redir https://kordyx.xyz/download/ 302
    }
}


https://143.20.50.6 {
    tls {
        issuer acme {
            dir https://acme-v02.api.letsencrypt.org/directory
            profile shortlived
            disable_http_challenge
        }
    }
    import kordyx-download-portal
}

downloads.kordyx.xyz {
    tls {
        issuer acme {
            dir https://acme-v02.api.letsencrypt.org/directory
            disable_http_challenge
        }
    }
    import kordyx-download-portal
}


http://127.0.0.1:8081 {
    respond /healthz "ok" 200
}
