{
    admin off
    auto_https off
}

:80 {
    encode zstd gzip

    handle_path /{$URL_PREFIX:api-address}/django_static/* {
        root * /app/staticfiles
        file_server
    }

    @spa path /{$URL_PREFIX:api-address} /{$URL_PREFIX:api-address}/
    handle @spa {
        root * /app/client
        rewrite * /index.html
        file_server
    }

    handle /{$URL_PREFIX:api-address}* {
        reverse_proxy 127.0.0.1:8001
    }

    handle {
        root * /app/client
        try_files {path} /index.html
        file_server
    }

    log {
        output stdout
        format console
    }
}
