Best way to prevent ip from outside USA from accessing angular frontend using nginx-ingress in k8s?

Currently looking for the best way to limit network access via ip to angular frontend using kubernetes nginx-ingress for ip addresses outside of the USA. I can see firewalls created with no rules for public access, but it seems like I have limited options for including logic to filter based on region. It would be painful to maintain a whitelist for obvious reasons from this view.

I am also aware of MaxMind’s GeoIP2 and using lua logic on the ingress, but I would prefer to use an easier option and was hoping DigitalOcean has something implemented for this use case that I am not seeing yet.

Thanks for the ideas/help!

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Site Moderator
Site Moderator badge
January 18, 2024

Hello there,

You can also use a third-party providers like CloudFlare that have Firewall features where you can block access from certain IP addresses or whole country IP ranges. They also regularly update their IP lists which means you’re likely to bypass some requests coming from proxies.

Just enter an IP address, an IP range, or a two-letter country code you wish to block

Hope that helps!

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel