ngx-l402 — an nginx module that puts a Lightning paywall (L402) in front of
any HTTP API.
Two directives:
l402 on;
l402_amount_msat_default 1000;
A request without payment gets a 402 with a macaroon + BOLT-11 invoice. Pay,
retry with the preimage, get your 200.
Non-custodial by design: sats settle straight to your own node or Lightning
address. No account, no intermediary, nothing routed through us.
Lightning backends: LND, CLN, Eclair, LNURL, NWC, BOLT12, LNC.
Cashu eCash works too — the client sends a token in the X-Cashu header
instead of paying an invoice. Proofs verify offline via NUT-12 DLEQ, so
there's no round-trip to the mint on the request path. Bearer, unlinkable,
and skipping the invoice round-trip makes it the fastest path of the lot.
It also publishes a capability manifest at /.well-known/l402-services, so
agents can discover your routes and prices and pay — no API key, no signup.
Live demo, 1 sat and learn more at: https://ngx-l402.org
Code (MIT): https://github.com/ngx-l402/ngx-l402
The repo is mirrored on Nostr via ngit (gitworkshop.dev) and release
binaries are on Blossom. GitHub flagged the org twice, so the project is
built to survive being deplatformed.
repo on ngit:- https://gitworkshop.dev/npub1qnw27f2jsqvn05wzpd56m7ykgmepk57p0yrzw8fzc7lfhjkmjmqqmd9r6h/relay.ngit.dev/ngx-l402
Release on blossom: https://nostr.download/03b6473139813e3c06361da15803a61e4c9f86111413a2467227825ed72b093d.gz
#bitcoin #lightning #l402