Question
Requests between subdomains on same droplet
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?
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.
×
If they are the same and the app is listening you can call localhost considering its on the same machine.