I have two nodejs apps that are running at localhost. 1st is listen on port 8080 and the second on port 8081 and i want to have single point where this apps are visible.
For example:
http://localhost/app1 --> http://localhost:8080
http://localhost/app2 --> http://localhost:8081
Saw that this can be done with http-proxy
but can't make it to work. Every example that i run is returning Error: Must provide a proper URL as target
My code is:
var http = require('http');
var httpProxy = require('http-proxy');
var options = {
pathnameOnly: true,
router: {
'/app1': 'http://localhost:8080',
'/app2': 'http://localhost:8081'
}
};
var proxyServer = httpProxy.createServer(options);
proxyServer.listen(80);
What is possible to be missing?