In order to replicate a problem some users are having with my application, I need to simulate a corporate proxy server which decompresses GZIP'd http traffic and doesn't recompress it before passing it to the destination server. The users are getting the error "the magic number in the GZIP header is incorrect" and it's my suspicion that the proxy server is not re-zipping the decompressed GZIPed traffic.
Is there a way I can simulate this using Fiddler? Specifically, I think I need to simulate proxys decompressing the body and perhaps not altering the headers to match.
Yes, Fiddler can manipulate the HTTP request and response in any way you like.
First, please confirm that your application GZIP's the request body. While compressing the response is very common, compressing the request is very uncommon for a number of reasons.
After that, you can do the following:
- In Fiddler, click
Rules
> Customize Rules
.
- Scroll to
OnBeforeRequest
.
Inside the method, add the following code:
if (oSession.oRequest.headers.ExistsAndContains("Content-Encoding", "gzip"))
{
oSession.utilDecodeRequest(); // Decompress request and remove header
oSession.oRequest["Content-Encoding"] = "gzip"; // Put header back
oSession["ui-backcolor"] = "yellow"; // Mark the session
}
Save the script.
Give a try to:
Recenly, I found that the GZIP zip/unzip feature in fiddler does not work properly. There are applications which are based on HTTP protocol and also zip HTTP Requests and Responses with GZIP format. So I decided to write some script using Fiddler Script Editor for converting and extracting Requests that are in GZIP format. Here is the code, copy this to the CustomRules.js file (Rules---->Customize Rules)
http://yossi-yakubov.blogspot.fr/2010/05/fiddler-gzip-issue.html