I'm currently working on a proxy server where we in this case have to modify the data (by using regexp) that we push through it.
In most cases it works fine except fo开发者_StackOverflow中文版r websites that use gzip as content-encoding (I think), I've come across a module called compress and tried to push the chunks that I receive through a decompress / gunzip stream but it isn't really turning out as I expected.
I was wondering if I am at all heading in the right direction, and if there are more modules out there to make my life easier (regarding gzip compression).
Greetz,
Benjamin
If you think your proxy is just for filtering or modifying text, you feel verbose about gzip compression and decompression.
Another solution is simple.
Modify http request header. Then you can get plain text from server.
Remove 'Accept-Encoding' from http request header.
See here: Node.js proxy, dealing with gzip DEcompression
For an answer that covered most of my problems.
Have a look there: Node.js: Gzip compression?
There is a alternative to using node-compress, but this solution is also mentioned.
Cheers,
-stan
精彩评论