The server settings say “compression is enabled,” but HTML and the main JavaScript file are sent without Content-Encoding. The cause may depend on the response type, size, an intermediary, or the Accept-Encoding header. Check the actual responses for the resources you need, not just a single hosting control.
Check the response for each text file
In HTTP, the client indicates supported encodings through Accept-Encoding, while Content-Encoding describes the encoding applied to the body. Official documentation.
The client indicates acceptable algorithms, and the server chooses a supported encoding or sends an uncompressed body. So a single “gzip enabled” control does not confirm the status of every resource. Get the HTML document, CSS, and main JavaScript file from the same release. For each, save the request with Accept-Encoding and the actual response. If a CDN handles compression, compare its public response with the response from the site’s server. Comparing one small CSS file with a larger JS file is not enough without accounting for the response type (MIME) and size threshold. Find the list of compressible MIME types and the minimum response size in the settings, then check HTML, CSS, and JS separately.
File type, size, and where compression happens
| Response | What affects compression | Where to look for the setting | What to check in the headers and body |
|---|---|---|---|
| HTML | Text document | Check encoding | Negotiated response |
| JavaScript | JavaScript file | Check MIME type | Not accidentally excluded |
| Small response | Size threshold | Check policy | Not an error by default |
| CDN and origin server | Different layers | Compare separately | No double encoding |
In the table, record the Content-Type, the size of the original resource, the applied encoding, and where compression is supposed to happen. Do not try to compress an already compact JPEG or another format again without measuring the benefit. For small text responses, a threshold may be an intentional setting. If JS is served as application/octet-stream, check whether this type is included in the compression rule and why the server did not specify the correct JavaScript type. Confirm that this is the actual file the page receives, not a local copy of the build. The size and type of the public response may differ from those of the expected source file.
Compare gzip and an uncompressed GET
In the browser, distinguish the size of the transferred data from the size of the parsed resource. Save Content-Encoding, Vary, and the request headers. Content-Length describes a specific transferred representation when that header is present; its absence does not prove that compression is absent. With curl, take into account whether you requested automatic decompression: the saved file may already be decoded. Do not compare its size with the bytes on the network as if they were the same measurement. Record Content-Encoding, the transferred bytes, and the decompression result. After making a change, open the page: a smaller response is useful only if the browser still runs the JavaScript without errors.
These commands are intended for the terminal; a developer can use them to check compressed and uncompressed responses.
curl -sS -H 'Accept-Encoding: identity' -D plain.headers -o plain.html 'https://example.com/'
curl -sS -H 'Accept-Encoding: gzip' -D gzip.headers -o page.gz 'https://example.com/'If the second response contains Content-Encoding: gzip, check gzip -t page.gz and decompress gzip -dc page.gz > decoded.html. If the header is absent, the file may be uncompressed: do not decompress it as gzip. The --compressed option automatically decodes the body, so it is not used here. For CSS and JS, repeat both commands, substituting the full URL of the required file from Network and separate output filenames. An empty Content-Encoding for both requests means that this response was not sent with gzip.
Why CSS is compressed but JS is not
Suppose the server compresses text/css, but the JavaScript MIME type is not included in the compression list. Request both using the same supported algorithm. After changing the relevant rule, request the same JS file again and confirm that Content-Type is still correct, Content-Encoding matches the body, and the page executes that code file. Also check a small text response below the configured threshold: it may intentionally remain uncompressed. This lets you check the specific compression rule. Do not change the entire build or minification at the same time; otherwise, it will be difficult to distinguish the effect of network encoding from changes to the resource itself.
Fix the type or compression rule
If the cause is the MIME type, fix how the type is served or update the list of supported text responses. If it is the threshold, assess the actual savings for the sizes you need. If it is an intermediary, find out where the body is decompressed and encoded again. Do not manually remove Content-Encoding while leaving the bytes compressed: the client will no longer interpret the response correctly. Likewise, do not add a gzip header to uncompressed content. Enable compression through the standard server or CDN setting that both encodes the body and sets the correct header. After making a change, check for loading errors and verify that JavaScript runs, rather than just checking that the number of kilobytes has decreased.
Check cache variants
Check that the cache stores a compressed response separately from the identity variant. The Vary: Accept-Encoding header is often part of this mechanism, but check the CDN settings for its specific capabilities. An uncompressed client must not receive an encoded body that it cannot read. Check the automatically decoded variant and a regular browser request. With two layers, avoid unintended double encoding. For pre-compressed static files, check that the server selects the appropriate variant and describes it correctly. A successful request to the origin server does not confirm how the public cache behaves.
Open the page with both response variants
HTML and JS are sent using the selected algorithm wherever the settings require it; the browser parses them without errors. The uncompressed request also receives a working body. A small file below the threshold may intentionally remain uncompressed.
Read also: Brotli compression: configuration for Nginx and Apache and CSS and JS minification: how much can it really speed up a site. Site checks are available on the reChecker technical audit page.