A quick and easy way to control clusters of Varnish Cache hosts using a RESTful JSON API.
Vaban is built in Go for high performance, concurrency and simplicity. Every request and every ban spawns its own lightweight thread. It supports Varnish 6/7+, Authentication, Pattern-based/VCL-based banning, health status, enable/disable backends, and more stuff to come.
- Git
- Go 1.27+
git clone https://tgragnato.it/vaban.git
cd vaban
go buildPut the file inside your application root, if installing from package: /opt/vaban/config.yml
---
service1:
hosts:
- "a.example.com:6082"
- "b.example.com:6082"
- "c.example.com:6082"
- "d.example.com:6082"
- "e.example.com:6082"
secret: "1111-2222-3333-aaaa-bbbb-cccc"
service2:
hosts:
- "x.example.com:6082"
- "y.example.com:6082"
- "z.example.com:6082"
secret: "1111-2222-3333-aaaa-bbbb-cccc"./vaban -p 4000 -f /path/to/config.ymlMake sure that the varnish admin interface is available on your hosts, listening on 0.0.0.0:6082
A quick and easy way to control clusters of Varnish Cache hosts using a RESTful JSON API.
JSON request payloads now prefer lowercase camel-case keys:
patternvclsetHealth
For backward compatibility, Vaban still accepts the legacy keys Pattern, Vcl and Set_health.
Get all groups:
-
Response 200 (application/json)
[ "group1", "group2", "group3", ]
Get all hosts in group:
-
Response 200 (application/json)
[ "test01:6082" ]
Scan hosts to see if tcp port is open:
-
Response 200 (application/json)
{ "test01:6082": { "Msg": "PONG 1431078011 1.0" } }
Check health status of all backends:
-
Response 200 (application/json)
{ "test01:6082": { "boot.be01": { "Admin": "probe", "Probe": "4/4", "Health": "healthy", } } }
Check health status of one backend:
-
Response 200 (application/json)
{ "test01:6082": { "backend01(10.160.101.100,,80)": { "Admin": "probe", "Probe": "3/4", "Health": "Healthy", } } }
force health status of one backend (can be healthy, sick or auto):
-
Request (application/json)
{"setHealth":"sick"}
-
Legacy Request (application/json)
{"Set_health":"sick"}
-
Response 200 (application/json)
{ "test01:6082": { "Msg": "updated with status 200 0" } }
To ban elements in your cache.
-
Request Ban the root of your website (application/json)
{"pattern":"/"}
-
Request Ban all css files (application/json)
{"pattern":"/.*css"}
-
Request Ban everything (application/json)
{"pattern":"/.*"}
-
Request Ban based on VCL, in this case all objects matching a host-header. (application/json)
{"vcl":"req.http.Host == 'example.com'"}
-
Legacy Request (application/json)
{"Pattern":"/"}
-
Legacy Request based on VCL (application/json)
{"Vcl":"req.http.Host == 'example.com'"}
-
Response 200 (application/json)
{ "test01:6082": { "Msg": "ban status 200 0" } }