Feature
Set the rules for every agent that crosses your app.
Policies run per lane: allow, deny, rate-limit, or price. Configure them in code, or publish them from Wayleave Meter as a signed policy your gate enforces.
Enforcement behavior
- Denials return 403 with x-wayleave-rule: <ruleId>.
- Quota denials return 429 with Retry-After.
- Policy is fetched on a timer and evaluated from memory.
- Tampered policy is refused; the last verified policy is kept.
- If Wayleave is unreachable, your traffic is unaffected.
Enforce a signed policy
const gate = new Wayleave({
policy: {
url: 'https://meter.wayleave.dev/v1/policy/public/<id>.json',
publicKey: WAYLEAVE_ROOT_KEY,
},
});
await gate.ready();
app.use(gate.express());
// deny -> 403 + x-wayleave-rule: <ruleId>
// quota -> 429 + Retry-AfterQuestions
What happens if the policy URL is down?
The gate keeps the last good policy; with no cache it behaves exactly as if no policy were configured.