I have several webservers running on a machine, and currently, in order to select which website you want to be served you must switch what port you are connecting on (domain:8000, domain:8001), however I really do not like this solution. My goal is to be able to connect via domain/process1, domain/process2 however the problem is the dns is always going to connect to domain:80 and then pass the route to express (What im using for the servers)
I am aware I could use express to control what code runs using
app.get('/process1', (req, res)=>{
process1.getRequest(req, res);
next();
});
app.get('/process2', (req, res)=>{
process2.getRequest(req, res);
next();
});
However, this requires all of my processes are running in a single instance of nodejs. My hope would be to not have to modify any of my current webservers and just create a single new process that will run on port 80 and redirect traffic to the different local ports based on the route.
I have seen This question however they have several domains whilst I only have a single domain. I also read a bit about a reverse-proxy/nginx, if at all possible I would love to stay within nodejs. Is it possible to create my own reverse-proxy in node?