In request header Accept-encoding: gzip, deflate, is missing, but in response header Content-encoding: gzip is present. does it cause compression failed. if yes, how to avoid it??
Request URL: http://something.com/something.js
Request Method: GET
Status Code: 200 OK 200 OK
Request Headers
Accept: */* Referer: somthing.comsomthing.aspx User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36 X-DevTools-Emulate-Network-Conditions-Client-Id: 2D3ED9B5-95BD-4984-9EEE-405C2889F11E
Response Headers
Accept-Ranges: bytes Content-Encoding: gzip Content-Length: 884 Content-Type: application/x-javascript Date: Tue, 28 Oct 2014 11:09:13 GMT ETag: "0ac99ce3e9fcf1:0" Last-Modified: Mon, 14 Jul 2014 08:37:12 GMT Server: Microsoft-IIS/8.0 Vary: Accept-Encoding X-Powered-By: ASP.NET
From RFC 7231:
A request without an Accept-Encoding header field implies that the user agent has no preferences regarding content-codings. Although this allows the server to use any content-coding in a response, it does not imply that the user agent will be able to correctly process all encodings.
In short: if you specify no Accept-Encoding
, it's legal (though ill-advised) for the server to send you compressed content. There doesn't appear to be a solid, reliable way to tell a web server that it should definitely not compress. You can try Accept-Encoding: *;q=0
or Accept-Encoding: identity
, but support for this is not universal across web servers, and proxies can mess things up as well.
In the end you are probably better off with simply handling compressed content if it comes back as such -- there is no good reason for a client to not support compression and libraries for this are freely available.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments