I can have a server with multiple domains using such a Caddyfile (+ https with letsencrypt):
site1.com {
reverse_proxy localhost:3001
}
site2.com {
reverse_proxy localhost:3002
}
site3.com {
reverse_proxy localhost:3003
}
But I want to run caddy without Caddyfile and I want to add such proxies dynamically via admin API.
They have an API for it, but I can't understand how to add a new reverse proxy for caddy without needing a Caddyfile.
I'm looking for a JSON format of this request, it can be something like this (pseudo-request):
curl localhost:2019/load \
-X POST \
-H "Content-Type: application/json" \
-data "{'domain': 'site1.com', 'tls': 'yes', 'proxy': 'http://localhost:3001'}"
curl localhost:2019/load \
-X POST \
-H "Content-Type: application/json" \
-data "{'domain': 'site2.com', 'tls': 'yes', 'proxy': 'http://localhost:3002'}"
Is it possible to add reverse proxies via API only? I'm using Caddy v2.0