Is it possible to call a webhook in caddy server

hi, I’m creating a reverse proxy using caddy. I’m wondering if it is possible to proxy to different ips based on a boolean value I have stored in a database.

I can create a webhook url on my external server to query this from the database and was wondering if caddy supports the ability to query a url and respond differently based on whether the webhook returns a 200 response

I know that you can use “ask” to query a url if the domain is authorized for ssl. I wanted something similar to this functionality but for more generic use.

Thanks in advance

There’s nothing built-in for this. Instead, you could write your own request matcher module which reaches out to your backend to make the decision.

Your module would be part of the http.matchers namespace, and implement the RequestMatcher interface:

https://pkg.go.dev/github.com/caddyserver/caddy/v2/modules/caddyhttp#RequestMatcher

2 Likes