Geoblock on Vercel ?
Unanswered
Barbary Lion posted this in #help-forum
Barbary LionOP
Using vercel and Next, how can one restrict an app to a certain country? Is this possible, I believe Cloudflare CDN has this kinda thing..
The reason for this is creating a fairly small app for clients in local country to assist with a local native desktop app
The reason for this is creating a fairly small app for clients in local country to assist with a local native desktop app
2 Replies
as you said, Vercel middleware is deployed to Cloudflare so geolocation details are passed via HTTP request, so you can use it to identify user's country. having said that some of users use VPN, so IPs could be VPN's IPs.
check my poc proj at
https://github.com/tfutada/zenn-nextjs/blob/main/middleware-geo.ts
check my poc proj at
https://github.com/tfutada/zenn-nextjs/blob/main/middleware-geo.ts
Barbary LionOP
yeah perfect! Thanks I I saw that I can use the geolocation in middleware, that's brilliant. Works like a charm.