Replies: 1 comment 1 reply
-
Create and register a middleware async handle ({ request, response }, next) {
const ip = request.ip()
if (['127.0.0.1','::1','192.168.1.1','etc'].indexOf(ip)===-1) {
response.status(403).send(''IP not whitelisted')
return
}
await next()
} Validate an IP Address (with Mask) I hope this can help you |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How to whitelist from IP Address by using middleware?
e.g 192.168.0.0/24
Beta Was this translation helpful? Give feedback.
All reactions