Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ veil Public
forked from try-veil/veil

Caddy Module to put your APIs behind a paywall and observabality stack.

License

akash0708/veil

 
 

Repository files navigation

Veil - API Management Module for Caddy

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

Features

  • Subscription-based access control
  • Request header validation
  • API usage statistics tracking
  • Dynamic API onboarding
  • SQLite database storage

Local Setup

  1. Clone the project
  2. Install the necessary dependencies, for macOS the script is present in ./scrips/setup/mac.sh
  3. The Makefile has the commands required for you to get around to working with Veil.

Configuration

Caddyfile Syntax

Refer the base Caddyfile for the config around registering Veil at port 2020.

Configuration Options

  • db_path: Path to the SQLite database file (default: "veil.db")

API Onboarding

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"}]
}' | jq

License

MIT License

About

Caddy Module to put your APIs behind a paywall and observabality stack.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 89.4%
  • Shell 3.7%
  • Python 3.3%
  • Makefile 2.0%
  • Dockerfile 1.6%