Report this

What is the reason for this report?

Requests between subdomains on same droplet

Posted on August 30, 2015

Let’s say I have two subdomains set on one droplet.

app.mydomain.com and api.mydomain.com

app.mydomain.com makes a request to api.mydomain.com which then returns data to app.mydomain.com. I’ve tested this and it works just fine, as expected.

Requests are a typical api type of query: http://api.mydomain.com/products?category=shoes and it returns a json response but I’m pretty sure that’s not important.

What I’d like to know, is because both subdomains are on the same droplet, is there a more secure or more efficient way to allow requests to api.mydomain.com.

Further, if I should decide to move api.mydomain.com to another droplet and therefore another IP address, what then in terms of private requests?



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!

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.

This question was answered by @MrPeppah:

If they are the same and the app is listening you can call localhost considering its on the same machine.

View the original comment

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.