You enabled gzip or Brotli on the server, but files are still served uncompressed. Or compression works for some files but not others. This is a common issue that affects page speed and Core Web Vitals. This guide explains why server compression is not working and how to fix it.
What server compression does
Server compression reduces the size of text-based files before sending them to the browser. The browser decompresses them. This reduces transfer size and speeds up loading.
Common compression methods:
— gzip — widely supported;
— Brotli — better compression, supported by modern browsers;
— deflate — older, rarely used.
Compression should be enabled for HTML, CSS, JavaScript, SVG, JSON and XML. Images and videos are already compressed and should not be compressed again.
Reason 1: compression is not enabled
The most common issue: compression is not enabled in the server configuration.
What to check:
— is gzip or Brotli enabled;
— is the module installed;
— is the configuration correct;
— was the server reloaded.
Use server compression checker to see whether files are compressed and which method is used.
Reason 2: MIME types not covered
Compression is applied only to specific MIME types. If a type is not listed, files of that type are served uncompressed.
Common types to include:
— text/html;
— text/css;
— text/plain;
— application/javascript;
— application/json;
— image/svg+xml;
— application/xml.
What to check:
— are all types listed;
— does the server send the correct Content-Type;
— are there types that are not covered.
Reason 3: CDN overrides compression
If the site is behind a CDN, the CDN may override compression settings. Some CDNs compress content themselves; others pass through the origin response.
What to check:
— does the CDN support compression;
— does the CDN strip Content-Encoding;
— does the CDN respect Vary: Accept-Encoding;
— does the CDN cache compressed and uncompressed versions separately.
If the CDN serves uncompressed content, check its compression settings.
Reason 4: browser does not send Accept-Encoding
Compression depends on the browser sending the Accept-Encoding header. If the browser does not send it, the server may serve uncompressed content.
What to check:
— does the request include Accept-Encoding;
— does it include gzip or br;
— is the header stripped by a proxy.
Most modern browsers send Accept-Encoding. If it is missing, the issue may be in a proxy or firewall.
Reason 5: static files are precompressed
Some servers use precompressed files (.gz, .br). If the precompressed files are missing or not served, compression may not work.
What to check:
— are precompressed files present;
— is gzip_static or brotli_static enabled;
— are precompressed files regenerated after updates.
How to diagnose compression issues
A practical sequence:
— check response headers for Content-Encoding;
— check the Accept-Encoding request header;
— check MIME types;
— check CDN settings;
— check server configuration;
— test with different file types.
If Content-Encoding is missing, compression is not applied. If it is present but the file size is not reduced, the file may already be compressed or the compression level is low.
For a broader audit, SEO audit can help verify compression, caching, TTFB and other speed factors in one place.
How to fix compression issues
Fix steps:
— enable gzip or Brotli;
— add all MIME types;
— configure CDN compression;
— ensure Accept-Encoding is passed;
— regenerate precompressed files;
— reload the server;
— test after changes.
FAQ
Why is server compression not working?
Most often because compression is not enabled, MIME types are missing, CDN overrides settings, or Accept-Encoding is not sent.
Should I use gzip or Brotli?
Use both. Brotli compresses better, gzip is a fallback for older browsers.
Why are some files not compressed?
Their MIME types may not be listed in the compression configuration. Check the Content-Type and add missing types.
Can a CDN break compression?
Yes. Some CDNs strip or override compression. Check CDN settings and Vary header.
Does compression affect SEO?
Indirectly. Compression reduces file size and improves speed, which affects Core Web Vitals and rankings.
Should images be compressed?
No. Images are already compressed. Server compression applies to text-based files.
What is precompression?
It is serving precompressed files (.gz, .br) without compressing on the fly. Useful for high-traffic sites.
How do I test compression?
Check response headers for Content-Encoding. Use a compression checker to see if files are compressed.
Why is compression not working after moving to a new server?
The new server may have different configuration or missing modules. Check the configuration and reload the server.
Can compression cause errors?
Rarely. If compression is misconfigured, some files may fail to load. Test after changes.