How to access second node application on same server?

Posted July 7, 2018 2k views

Hi there!
Sorry if this was asked already; I searched for quite some time, but did not manage to find a solution to my issue.

In a nutshell I’m trying to send http request from my one nodejs application to the other, both residing on the same digitalocean server. (localhost:8080 and localhost:3000)
Only localhost 8080 is meant to be accessed from the outside, 3000 is an API that could remain local to the server.

However when executing those queries, they are not received.

I might be off with my understanding, but the same setup up is working on my local machine, shouldn’t that be true for the server as well?
Is there a reason why you would not be able to access a second nodejs app locally?

I’m a weird engineer doing programming, so please have mercy with my soul and I would appreciate any help especially if it includes some explanations about network fundamentals.

Thank you so much already!

1 comment
  • EDIT: I just read up on curl and checked via the terminal that I indeed can access the endpoint that I expose locally.
    Some endpoint however coming from the axios request from my react frontend does not work, are there any headers maybe I need to set for my request in this different environment?

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.

Submit an Answer
1 answer
by Jesin A
This tutorial will show you how to configure Nginx as both a web server and as a reverse proxy for Apache – all on one Droplet. Depending on the web application, code changes might be required to keep Apache reverse-proxy-aware, especially when SSL sites are configured. To ensure this, we will install an Apache module named **mod_rpaf** which rewrites certain environment variables so it appears that Apache is directly handling requests from web clients.