Bad Proxy

A fairly bizarre issue come up recently that I thought would be amusing to share.  It all started fairly simply.  One of the development teams needed to test some website changes that required overriding some of the website files without making changes to the website itself.  This is not difficult for a developer to do, but they wanted to set it up more simply for a number of testers to use.  I suggested setting up a proxy server and configure it to proxy most requests on to their normal location.  Then send requests for the files they wanted to test on to the test location.  We would only need it for a week or two during the test phase.

I had a little free time, so I decided to set it up for them.  I considered setting up an apache instance using mod_proxy and mod_rewrite.  I decided instead to write something custom in Node.js.  It took me about an hour to write a custom proxy server and add rules to detect requests for the test files and rewrite the request before proxying it.  I turned it on, tested by changing my local hosts file to direct website requests to my proxy server, and all was good. Continue reading “Bad Proxy”