Curl showing gzip but chrome showing no gzip header
Asked Answered
D

2

8
curl -I -H 'Accept-Encoding: gzip,deflate' https://example.com/a.min.js


HTTP/1.1 200 OK
Server: nginx
Date: Thu, 22 Jun 2017 02:45:49 GMT
Content-Type: application/javascript; charset=utf-8
Content-Length: 5430
Connection: keep-alive
X-Accel-Version: 0.01
Last-Modified: Sat, 14 Jan 2017 12:50:18 GMT
Accept-Ranges: bytes
Vary: Accept-Encoding,User-Agent
Content-Encoding: gzip
X-Powered-By: PleskLin
Cache-Control: max-age=2628000, private

Here it is very clear that file is gzipped but in case of chrome, pagespeed and gtmetrix they are mentioning this file is not compressed. There is no content encoding in header when i view in chrome.

Also my homepage is being compressed with gzipp. when using varvy service they are saying your local files are not compressed.

I have enabled compression in nginx and apache both. also in .htaccess. but this is very weired.

Deeply answered 22/6, 2017 at 3:6 Comment(1)
Same here, and no solution! :(Cooker
B
1

I just faced similar problem and found it was the antivirus extracting the gzipped assets.

I had to completely disable the antivirus and restart the browser.

See as well X-Content-Encoding-Over-Network in Response Header but not Content-Encoding

Bickerstaff answered 4/10, 2020 at 17:1 Comment(0)
S
0

I think it has something to do with caching.

If I had to guess, I'd say each curl request grabs a fresh response from the server with gzip encoding. Chrome on the other hand, utilizes caching which seems to store the file after decompressing it. Chrome then serves you the decompressed file (no gzip encoding) from cache.

I ran into a similar problem with chrome dev tools, and noticed that the content-encoding header was included only when I disabled caching (or hard refreshed)

This forum goes a little more in-depth about it

Showdown answered 8/2, 2022 at 7:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.