Veil is a Caddy module that provides API management capabilities, including subscription-based access control and request validation. It acts as a middleware that validates API requests based on subscription levels and required headers.
A demo of veil in action could be found here
- Subscription-based access control
- Request header validation
- API usage statistics tracking
- Dynamic API onboarding
- SQLite database storage
- Clone the project
- Install the necessary dependencies, for macOS the script is present in ./scrips/setup/mac.sh
- The Makefile has the commands required for you to get around to working with Veil.
Refer the base Caddyfile for the config around registering Veil at port 2020.
db_path: Path to the SQLite database file (default: "veil.db")
To onboard a new API, send a POST request to the management endpoint:
curl -X POST http://localhost:2020/veil/api/onboard \
-H "Content-Type: application/json" \
-d '{
"path": "/weather/*",
"upstream": "http://localhost:8082/weather",
"required_subscription": "weather-subscription",
"methods": ["GET"],
"required_headers": ["X-Test-Header"],
"api_keys": [{"key": "weather-test-key-2", "name": "Weather Test Key 2"}]
}' | jqMIT License