Skip to content

Commit b809a0e

Browse files
set accept-encoding header to gzip when using gunzip middleware
Otherwise the server may use another content-encoding algorythm (like SDCH) Fix #80
1 parent 418ad0c commit b809a0e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/middleware/gunzip.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ module.exports = {
1010
ctx.addResponseFilter(zlib.createGunzip());
1111
}
1212
return callback();
13+
},
14+
onRequest: function(ctx, callback) {
15+
ctx.proxyToServerRequestOptions.headers['accept-encoding'] = 'gzip';
16+
return callback();
1317
}
1418
};
1519

0 commit comments

Comments
 (0)