caddyserver / caddy

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
https://caddyserver.com
Apache License 2.0
56.49k stars 3.96k forks source link

Notify when a request is done #5996

Closed EricFROL closed 8 months ago

EricFROL commented 8 months ago

As title says, is there anyway to notify me via webhook or mail when a simple http request is done to server?

So getting into, for example, example.com, would trigger a webhook that notifies me somehow.

francislavoie commented 8 months ago

You'd be best off finding a plugin to do what you need or write your own. See https://caddyserver.com/docs/extending-caddy

mholt commented 8 months ago

Or ingest the logs. The access logs are written when the request is done.

EricFROL commented 8 months ago

Any advice on how to do that? Don't really know how to start... I know how to compile caddy with plugin, but no ideas

mholt commented 8 months ago

There might already be tools out there that ingest logs and let you do events based on the logs. I'm not well versed in that space but I'd be surprised if something doesn't already exist.

As a Caddy plugin, the docs are on that page. It steps you through building an HTTP handler, which is probably what you'd want. After the call to next.ServeHTTP() you'd want to do your own logic there.