really excited about this. a few questions:
1) do you have a way to write headers, at least for the first incoming HTTP request on that socket? 2) do you have a way to pass the origin IP to the balanced server. --------------- I've had a lot of luck with stud-proxy lately. For me, i drop the origin IP and the backend application processes are unaware of it. But, stud has this interesting thing it does, it will use the first 5 bytes of every new TCP connection to tell me the origin IP. this got me thinking, why can't I do this for a load balancer? the hangup is that the applications processes would need to be using a special server, not a generic HTTP server. that could be problematic for many use cases but it could work for me. just thinking out loud a little. very interested in this approach. -Mikeal On Jun 15, 2012, at June 15, 20128:45 AM, Dominic Tarr wrote: > so, > > For a while I've been wondering, could I make a *really* simple proxy? > > Although in http 1.1 multiple requests may be made in the same tcp > connection, a well behaved client is not allowed > to make requests to different hosts in the same connection, so this > begs the question: is it necessary to properly parse http? > as long as you can parse the first header, and then connect the tcp > stream to the right place... then every thing should just work, > including WebSockets. > > It was marak who originally suggested this idea to me. > > so, today I actually tried it... and it looks like: IT WORKED!!! > > https://github.com/dominictarr/badass > > npm install badass > > I've implemented just enough to make a load-balancer with sticky > sessions. basically it just matches the text before the first empty > line. pulls out the headers with a few regexps, and then just sends > the rest through as buffers. it also extracts the first header on the > response, so you can force a cookie to get sticky sessions. > > it's only about 100 lines, and it does next to nothing to the tcp > stream, so it should be really fast. > > but I havn't benchmarked it yet. > > also, I havn't written a detailed test suite that cover all the error paths. > (connections unexpectedly closing etc) > > There are some things that will never do, like, deliver it's own error > messages. > But thats okay. I'm trying to be ruthlessly simple. > If you want a fully featured proxy, use something else. > > cheers, Dominic > > -- > 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
