I know cloudflare has a free tier and allows you to put rules like this in place. AFAIK you'd have to use them as DNS at least in order to use this feature. I use Cloudflare tunnels and access to facilitate remote access to my home-server, and I know I have this same rule in place.
Cloudflare DNS basically, but it can be implemented at nginx level using geoip2 modules (I do both, because some of my services don't play well with Cloudflare proxied DNS). The cumbersome part is keeping geoip database up to date but I'm sure there are plenty of tutorials online.
I’m using an nginx reverse proxy with maxminddb for geo filtering. I have it limited to my state instead of country. If I could reliably go more specific I would. I really only rely on external access to the reverse proxy for family. I could use a vpn myself but I’m not bothering with the inevitable and endless questions from family.
I don’t know if it’s realistic or not but I would love to use a client certificate to authenticate with the reverse proxy but I’m not sure of the compatibility with mobile devices or smart TVs. If it would work even a self signed cert that’s valid for years would be a nice layer.