Express middleware to reject requests from all Russian IPs.
Table of contents:
npm install byeivan
import express from 'express';
import byeivan from 'byeivan';
const app = express();
app.use(byeivan());
import express from 'express';
import byeivan from 'byeivan';
const HTTP_I_AM_A_TEAPOT = 418;
const app = express();
app.use(byeivan({
body: 'bye bye Ivan! Гражданин России, иди нахуй!',
status: HTTP_I_AM_A_TEAPOT,
}));
In order to retrieve a client IP address we use request-ip library. Please check its documentation and make sure that your reverse proxy passes at least one of required headers containing client's IP address