Created by: yanneves
Towards the end of putting this together and testing it works, I found a solution combining regex entries in the proxy table to achieve a default to similar effect. But, this certainly makes for a tidier solution so I'll put it forward.
Have included an example in this pull request to demonstrate what I'm trying to do.
The ProxyTable will now support a 'default'
entry (unless hostnameOnly:true
is flagged).
var options = {
router: {
// normal proxy
'localhost/proxied': 'localhost:9000',
// default proxy if no match above,
// this would also work if set as 'localhost'
// but intended for more complex scenarios
'default': 'localhost:9001'
}
};
httpProxy.createServer(options).listen(8000);