Configure Caddy to send a request while processing incoming request

Is there a possibility to send a request to an external service, asking for permission, before Caddy is processing a request when configured as a reverse proxy?

example.com {
    # send a request to api.example.com before continuing
    # if response == 200 -> continue
    # if response == 403 -> return 403
    reverse_proxy {
        to app1:8000 app2:8000
    }
}

I’m basically looking for the equivalent of nginx auth_request directive: Module ngx_http_auth_request_module

There’s nothing out-of-the-box for this yet, no, but you can write a custom module for Caddy to do this pretty easily:

This topic was automatically closed after 30 days. New replies are no longer allowed.