:80 {
    handle /health {
        respond "AppFactory OK" 200
    }

    handle /portal* {
        uri strip_prefix /portal
        reverse_proxy appfactory-portal:9100
    }

    handle /apps {
        root * /srv/static
        rewrite * /apps.html
        file_server
    }

    handle_path /apps/microsoft-365-service/* {
        reverse_proxy microsoft-365-service:8000
    }

    handle_path /webhook/* {
        reverse_proxy appfactory-webhook:9000
    }

    handle_path /registry/* {
        reverse_proxy appfactory-registry:5000
    }

    handle {
        respond "AppFactory gateway is running" 200
    }
}
