Publishing negative results...
Nov. 30th, 2011 12:44 pmThe other day, I blogged proudly about a piece of code called Switchboard, which allowed you to create a reverse proxy with routes decided by URL rather than host. Nginx does this, but it only has HTTP/1.1 <–> HTTP/1.0 proxying and no control over buffer sizes. Varnish does all 1.1, but no SSL. Pound buffers uploads completely to RAM before forwarding. So I wrote Switchboard.
It turns out Switchboard is a massive hack to get around three bugs in the nodejitsu node-http-proxy library, which is what Switchboard uses. Once I realized this, I submitted three patches to the nodejitsu team, and have happily admitted that my code was a monstrous hack. A much smaller piece of code, two functions, each less than ten lines long, was all that was needed to replace the entire functionality of that 161-line monstrosity.
I'm very pleased with the results, however: I can now do HTTP/1.1 <–> HTTP/1.1 reverse proxying, have complete control over my upload buffer size, and can maintain proxied websockets and socket.io communications channels.
It turns out Switchboard is a massive hack to get around three bugs in the nodejitsu node-http-proxy library, which is what Switchboard uses. Once I realized this, I submitted three patches to the nodejitsu team, and have happily admitted that my code was a monstrous hack. A much smaller piece of code, two functions, each less than ten lines long, was all that was needed to replace the entire functionality of that 161-line monstrosity.
I'm very pleased with the results, however: I can now do HTTP/1.1 <–> HTTP/1.1 reverse proxying, have complete control over my upload buffer size, and can maintain proxied websockets and socket.io communications channels.
no subject
Date: 2011-12-01 07:31 pm (UTC)I always think that knowing this stuff is a matter of saying, "What do I want? What do I have to know to do it? And where do I go to find out?" Sometimes, you have to practice. The switchboard problem (which I've kept on github, and updated to reflect the new things I've learned) is a sign of me embracing my suck (http://sarahwagneryost.com/why-its-so-awesome-that-you-suck/), as we say in the geek business.
no subject
Date: 2011-12-02 01:41 am (UTC)I am totally impressed by your knowledge of and ability to navigate the systems you are in.