nodejitsu/node-http-proxy — pull request #317 by fmarier (2012-10-17 06:15:28+00:00)
Title: Set the content-type header prior to writing the rest of the headers (fixes #316)

This allows the connect.compress() middleware to work on proxied requests.

If this header is not manually set then the compress middleware will be invoked in the writeHead() call:

https://github.com/nodejitsu/node-http-proxy/blob/1df2b30e84f078d86e744601bd6fc59381a1c7b3/lib/node-http-proxy/http-proxy.js#L260

before the header has been written. Therefore it will perform its content-type check:

https://github.com/senchalabs/connect/blob/7b5621b8dd4d9d82296b9b5d7bf3bea10de37a6c/lib/middleware/compress.js#L94

and so the check will fail and compression will be disabled.