Next.js Discord

Discord Forum

Using vercel, ban IPs accessing endpoints

Unanswered
Japanese jack mackerel posted this in #help-forum
Open in Discord
Avatar
Japanese jack mackerelOP
Is there any way to automate, either through the vercel server portal or through an endpoints code, to ban any ip that accesses it?

just launched a website and already got dictionary attacked, would like to set it up so if someone tries to access say /admin itll just ban the ip as im not using that

2 Replies

Avatar
yes you can use a middleware that checks if a specific part is visited. If the path is visited, you can then call the rest api from vercel for their firewall: https://vercel.com/changelog/rest-api-for-the-vercel-firewall

To create a custom rule. With that you can enter the details and the IP is blocked for future request with the firewall
Avatar
@Japanese jack mackerel solved?