By Nuwanda
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!
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.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
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
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.