Question

Firewall only allow domain not a static IP

i would like secure a droplet with the DO firewall to only allow https requests from a specific domain as its ip changes often so cant set a static ip


Submit an answer
Answer a question...

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.

Bobby Iliev
Site Moderator
Site Moderator badge
February 6, 2023

Hi there,

The DigitalOcean firewalls are layer 4 firewalls, meaning that you can only filter TCP and UDP traffic. To be able to filter based on the domain name, you could do that via your web server, for example if you are using Nginx, then you could create a catch all Nginx server block and block all of the traffic, eg:

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name _;
    return 412;
}

Then you could have your standard Nginx server block for your domain name as normal.

KFSys
Site Moderator
Site Moderator badge
February 6, 2023

Hi @edwardshark,

If the IP address changes it’s going to be a little harder. Having said that, what you can do is if you know the range of the said IP to allow the range. That way if the IP changes with another from that range, you’ll still have it allowed.

Is that something you would consider?

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.