1. Caddy version (caddy version
):
v2.0.0
2. How I run Caddy:
caddy run
a. System environment:
Ubuntu 20.04
3. My question
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 dinamically via admin API.
Caddy has API for it, but I can’t understand how to add a new reverse proxy for a caddy without Caddyfile at all.
I’m looking for a JSON format of this request, it can be something like this (fake 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?