I spoke too soon, excuse for my "newbieness" but the docs are not
making things easier, why isnt an API list somewhere?
>From the examples page on github, I want to combine this config for
simple reverse-proxying
var options = {
hostnameOnly: true,
router: {
'foo.com': '127.0.0.1:8001',
'bar.com': '127.0.0.1:8002'
}
}
With this, loadbalancing for every backend app:
var httpProxy = require('../../lib/node-http-proxy');
//
// A simple round-robin load balancing strategy.
//
// First, list the servers you want to use in your rotation.
//
var addresses = [
{
host: 'ws1.0.0.0',
port: 80
},
{
host: 'ws2.0.0.0',
port: 80
}
];
On Apr 13, 6:46 pm, akira <[email protected]> wrote:
> Great! Thanks Chris!
>
> On Apr 13, 6:36 pm, Chris Rhoden <[email protected]> wrote:
>
>
>
>
>
>
>
> > On Fri, Apr 13, 2012 at 12:01 PM, akira <[email protected]> wrote:
> > > Ok, so that means I leave the bodyParser middleware config out of the
> > > node-proxy config?
>
> > Yes.
>
> > > What I meant by my typical use case is this:
>
> > > # Vhosts
> > > apps A1 on port 8001, A2 on port 8002 are load balanced and serves --
> > > >www.domainA.com
> > > app B:9001, B2:9002 are also load balanced and serving requests for --
> > > >www.domainB.com
>
> > Sure, you can build that. Round-robin strategies are mentioned
> > here:http://blog.nodejitsu.com/http-proxy-intro
>
> > > Was that clear?
>
> > > On Apr 13, 5:32 pm, Chris Rhoden <[email protected]> wrote:
> > > > I can at least answer the first question, which is that it doesn't work
> > > > easily if you're using bodyparser in front of it. Using bodyparser in
> > > your
> > > > apps and http-proxy in front of them, there's no issue.
>
> > > > I am not sure I understand your second question.
>
> > > > On Fri, Apr 13, 2012 at 10:35 AM, akira <[email protected]> wrote:
> > > > > Ok, but I am still not sure about 2 things.
>
> > > > > 1. I read that node-http-proxy does not work with the body parser
> > > > > middleware. How is one supposed to handle forms and other things then?
> > > > > I have my app configured as follows:
>
> > > > > app.use(express.bodyParser({ keepExtensions: true, uploadDir:
> > > > > __dirname + "/public/uploads" }));
>
> > > > > 2. I saw the examples on the github page, but no example of my use
> > > > > case. I would like to run multiple sites, each with multiple backends.
> > > > > Thats the way I use Cherokee or Nginx at the moment. Can someone
> > > > > provide an example?
>
> > > > > Thanks
>
> > > > > On Apr 13, 2:19 pm, Alan Hoffmeister <[email protected]>
> > > > > wrote:
> > > > > > I'm actually using mongodb to store those rules, as simple as pie.
> > > > > > --
> > > > > > Att,
> > > > > > Alan Hoffmeister
>
> > > > > > 2012/4/13 Chris Rhoden <[email protected]>:
>
> > > > > > > Another reason people use node-http-proxy is that it's actually
> > > > > javascript,
> > > > > > > which means that one can configure it however they like as they're
> > > > > working
> > > > > > > in a true turing complete language. If you want to store your
> > > rules in
> > > > > redis
> > > > > > > and have a dashboard to change them on the fly, there's nothing
> > > > > stopping
> > > > > > > you.
>
> > > > > > >https://github.com/nodejitsu/node-http-proxy/issues/198pingpeople
> > > > > here if
> > > > > > > you want benchmarks.
>
> > > > > > > On Fri, Apr 13, 2012 at 8:02 AM, Alan Hoffmeister
> > > > > > > <[email protected]> wrote:
>
> > > > > > >> @akira, I had experience with nginx and other languages, but this
> > > is
> > > > > > >> the first time that I had deployed a 100% javascript stack.
> > > > > > >> Let's wait and see what this stack it's capable of.
>
> > > > > > >> A good point for node-http-proxy is the support for socket.ioout
> > > > > > >> of
> > > > > the
> > > > > > >> box ;)
>
> > > > > > >> --
> > > > > > >> Att,
> > > > > > >> Alan Hoffmeister
>
> > > > > > >> 2012/4/13 akira <[email protected]>:
> > > > > > >> > This is very interesting. I always though that Node developers
> > > use
> > > > > > >> > Nginx in their stack for proxying. But reading the docs,
> > > node-http-
> > > > > > >> > proxy is mentioned as battle-hardened. How does this hold up
> > > when
> > > > > one
> > > > > > >> > serves images? Is the performance comaparable? Nginx is alleged
> > > to
> > > > > be
> > > > > > >> > almost unbeatable at serving static files, but if there is some
> > > way
> > > > > to
> > > > > > >> > optimize a pure node stack, I would not really mind if it was a
> > > bit
> > > > > > >> > slower.
>
> > > > > > >> > Anyone with experience on this? Figures?
>
> > > > > > >> > Thanks
>
> > > > > > >> > On Apr 12, 11:25 pm, mlegenhausen <[email protected]>
> > > wrote:
> > > > > > >> >> @alan Why you want to do that? You also normally don't run
> > > several
> > > > > > >> >> MySQL
> > > > > > >> >> instances for each site? That's why you can define databases
> > > and
> > > > > > >> >> collections and not just only collections ;)
>
> > > > > > >> > --
> > > > > > >> > Job Board:http://jobs.nodejs.org/
> > > > > > >> > Posting guidelines:
>
> > >https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> > > > > > >> > You received this message because you are subscribed to the
> > > Google
> > > > > > >> > Groups "nodejs" group.
> > > > > > >> > To post to this group, send email to [email protected]
> > > > > > >> > To unsubscribe from this group, send email to
> > > > > > >> > [email protected]
> > > > > > >> > For more options, visit this group at
> > > > > > >> >http://groups.google.com/group/nodejs?hl=en?hl=en
>
> > > > > > >> --
> > > > > > >> Job Board:http://jobs.nodejs.org/
> > > > > > >> Posting guidelines:
>
> > >https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> > > > > > >> You received this message because you are subscribed to the
> > > > > > >> Google
> > > > > > >> Groups "nodejs" group.
> > > > > > >> To post to this group, send email to [email protected]
> > > > > > >> To unsubscribe from this group, send email to
> > > > > > >> [email protected]
> > > > > > >> For more options, visit this group at
> > > > > > >>http://groups.google.com/group/nodejs?hl=en?hl=en
>
> > > > > > > --
> > > > > > > chrisrhoden
>
> > > > > > > --
> > > > > > > Job Board:http://jobs.nodejs.org/
> > > > > > > Posting guidelines:
> > > > > > >https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> > > > > > > You received this message because you are subscribed to the Google
> > > > > > > Groups "nodejs" group.
> > > > > > > To post to this group, send email to [email protected]
> > > > > > > To unsubscribe from this group, send email to
> > > > > > > [email protected]
> > > > > > > For more options, visit this group at
> > > > > > >http://groups.google.com/group/nodejs?hl=en?hl=en
>
> > > > > --
> > > > > Job Board:http://jobs.nodejs.org/
> > > > > Posting guidelines:
> > > > >https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> > > > > You received this message because you are subscribed to the Google
> > > > > Groups "nodejs" group.
> > > > > To post to this group, send email to [email protected]
> > > > > To unsubscribe from this group, send email to
> > > > > [email protected]
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/nodejs?hl=en?hl=en
>
> > > > --
> > > > chrisrhoden
>
> > > --
> > > Job Board:http://jobs.nodejs.org/
> > > Posting guidelines:
> > >https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> > > You received this message because you are subscribed to the Google
> > > Groups "nodejs" group.
> > > To post to this group, send email to [email protected]
> > > To unsubscribe from this group, send email to
> > > [email protected]
> > > For more options, visit this group at
> > >http://groups.google.com/group/nodejs?hl=en?hl=en
>
> > --
> > chrisrhoden
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en