nginx-waf-api

April 1, 2026 · View on GitHub

REST API daemon for dynamic control of nginx-waf module.

Overview

nginx-waf-api is a standalone Go daemon that provides a REST API for dynamically managing nginx-waf IP lists without manual file editing or nginx configuration changes.

Features

  • REST API for IP list management (CRUD operations)
  • API key authentication
  • Automatic nginx reload after changes
  • Audit logging of all modifications
  • Prometheus metrics endpoint
  • Atomic file operations (no partial writes)

Architecture

API Client ──> nginx-waf-api ──> IP List Files ──> nginx-waf
 (UI/CLI)     (Go daemon)     (/etc/nginx/...)    (C module)

API Endpoints

MethodEndpointDescription
GET/api/v1/listsList all IP lists
GET/api/v1/lists/{name}Get list details
POST/api/v1/lists/{name}/entriesAdd IP to list
DELETE/api/v1/lists/{name}/entries/{ip}Remove IP from list
POST/api/v1/reloadTrigger nginx reload
GET/healthHealth check
GET/metricsPrometheus metrics

Quick Start

# Build
make build

# Configure
cp conf/config.example.yaml /etc/nginx-waf-api/config.yaml
# Edit configuration...

# Run
./nginx-waf-api -config /etc/nginx-waf-api/config.yaml

Installation

Available for Fedora, openSUSE, Debian, and Ubuntu via OBS.

From source

make build
sudo make install
sudo cp conf/config.example.yaml /etc/nginx-waf-api/config.yaml
sudo cp dist/nginx-waf-api.service /etc/systemd/system/
sudo systemctl enable --now nginx-waf-api

nginx-waf Ecosystem

Other Nginx Modules

License

BSD 3-Clause License - see LICENSE.md for details.