Node.js (Restify)
Requirements
Installation & Configuration
1
Install Zen Firewall by Aikido
npm install --save-exact @aikidosec/firewallyarn add --exact @aikidosec/firewallpnpm add --save-exact @aikidosec/firewallrequire("@aikidosec/firewall");
const restify = require("restify");
const server = restify.createServer();import "@aikidosec/firewall";
import restify from "restify";
const server = restify.createServer();2
4
Enable Rate limiting and User blocking
const Zen = require("@aikidosec/firewall");
// Optional middleware to set user for rate limiting or blocking specific users
server.use((req, res, next) => {
Zen.setUser({ id: "123", name: "John Doe" });
return next();
});
// Call this after auth middleware, as early as possible in the middleware stack
Zen.addRestifyMiddleware(server);5
Setup rate limiting in the dashboard



You are rate limited by Aikido firewall. (Your IP: 1.2.3.4)Last updated
Was this helpful?
