-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using wildcards or regex in router tables? #355
Comments
Wait, nevermind, I forgot to remove the |
Wait, nevermind. I'm still having some trouble. So If I have var httpProxy = require('http-proxy'),
apache = '127.0.0.1:5678',
node = '127.0.0.1:1234';
var options = {
router: {
'foobar.com' :node,
'barfoo.com' :apache
}
}
var proxyServer = httpProxy.createServer(options);
proxyServer.listen(80);
console.log('Proxy server started on port 80.'); and I try to visit var httpProxy = require('http-proxy'),
apache = '127.0.0.1:5678',
node = '127.0.0.1:1234';
var options = {
router: {
'foobar.com' :node,
'one.two.three.foobar.com' :node,
'barfoo.com' :apache
}
}
var proxyServer = httpProxy.createServer(options);
proxyServer.listen(80);
console.log('Proxy server started on port 80.'); Can we prevent having to add the extra line for |
I also had this issue. I think the general solution would be to allow a callback function for when there is no match in the router table. We are using such a solution in production. Pull request: |
@breck7 That's a good idea. I think changing the router functionality so that regex can be used would be very nice. Or maybe something like Google Chrome's settings where you can add domain exceptions to various settings like [*.]foobar.com which matches anything.foobar.com or whatever.foobar.com. |
Hi, if I do the following, then
www.foobar.com
doesn't work:To make
www.foobar.com
work I have to add it manually:I would also have to add any other subdomains manually. How can I avoid doing that so that for example all requests to
barfoo.com
go to apache regardless of the subdomain? If those were regex, thenfoobar.com
would matchanything.foobar.com
but that's not the case.The text was updated successfully, but these errors were encountered: