Easy:
- Add your site to Cloudflare
- Block any country you want
- Enjoy your CDN and hiding your server ip for free
- ??? profit
The only thing you lose is the ability to see the real IP of users if you are using a reverse proxy + cloudflare, but that can probably be fixed too if you really care about it.
Maybe there are other CDN’s that can do it, but with a free CDN like Cloudflare that can serve the needs of like 90% of the websites for free I don’t see a reason to look for another one.