@tinyhttp/ip-filter

npm (scoped) npm

IP Filtering middleware to send 403 on bad IPs.

Install

pnpm i @tinyhttp/ip-filter

API

import { ipFilter } from '@tinyhttp/ip-filter'

ipFilter(options)

Returns the IP filter middleware.

Options

Example

import { App } from '@tinyhttp/app'
import { ipFilter } from '@tinyhttp/ip-filter'

const app = new App()

app.use(ipFilter({ forbidden: 'Get the f*ck out of my server!', filter: [`*.example.com`], strict: true }))

app.get('/', (req, res) => {
  res.send('Hello World!')
})

app.listen(3000)

Install

pnpm i @tinyhttp/ip-filter

Version

1.3.15

Source

@tinyhttp/ip-filter