Question

Sending HTTP requests to IP address

I about to deploy a server to DO but I have a concern that I thought I should address before I do. My server will not have a domain name because I’m going to be sending HTTP requests to it from a mobile application using it’s IP. My question is, is this do-able? Does DO allow sending requests to droplets using their IP/port or do I have to mess around with the firewall and opening ports etc?


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.

Accepted Answer

@mustard

Droplet’s are essentially VPS’s, which means they’ll function however you set them up. You can setup the web server or backend (of your choice) to accept requests via IP, or you can use a domain. It just depends on what you need. There’s really no limitation there :-).

In terms of using a firewall, it is recommended as the IP’s are public and therefore open to the public. That means that without a firewall running and limiting what ports a visitor can connect to, they could potentially attempt to connect on any port.

Ideally, I setup ufw in the following manor:

Disable the Firewall

ufw disable

Reset the Firewall

ufw reset

Deny All Incoming Requests

ufw default deny incoming

Allow All Outgoing Requests

ufw default allow outgoing

Now, we’ll only allow in a select few ports – 22 (SSH), 80 (HTTP), and 443 (HTTPS).

ufw allow 22/tcp
ufw allow 80/tcp
ufw allow 443/tcp

With ufw now setup, we’ll turn it on.

ufw enable

Now the only ports that anyone is allowed to connect on are 22, 80, and 443. The rest will be denied.

Hi @mustard

Technically there is no difference between having requests going to a domain or not - from DigitalOcean’ point. So yes, DO allows this.

But from long experience, please don’t do this. If you suddenly want to move to another server or do anything where you loose the IP, then you need to create a new mobile application and push that to every device. Use (sub)domains, that way you can modify the DNS and you won’t have to redo your mobile app.

Become a contributor for community

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

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.