I want a proxy with path based routing. But my code not working
var httpProxy = require('http-proxy')
var proxy = httpProxy.createProxy();
var options = {
'example.com/app1': 'http://localhost:4444',
'example.com/app2': 'http://localhost:3333'
}
require('http').createServer(function(req, res) {
proxy.web(req, res, {
target: options[req.headers.host]
},function(error) {
});
}).listen(80);
How is the problem?
Thanks for Help