On this page
What this issue is
Compression makes pages smaller for travel. The server adds a header such as Content-Encoding: gzip or Content-Encoding: br (Brotli), and the browser unpacks the page. It goes wrong in a few ways.
- Double compression: the origin and the CDN or proxy both compress, so the body cannot be unpacked.
- Wrong header: the body is plain text but the header says gzip, or the reverse.
- Truncated body: the connection closes early, or
Content-Lengthdoes not match the bytes sent. - Broken Brotli or gzip stream: a PHP error, a timeout or a full disk cuts the stream mid-way.
- Cache serving a compressed copy to a client that did not ask for compression.
Chrome often reports this as ERR_CONTENT_DECODING_FAILED. A crawler may not show any error. It may simply index a half page or skip it.
Why it costs you leads or sales
If the HTML is cut off, the part that is missing may be the form, the buy button, the footer scripts or the tracking tags. Visitors see a blank or broken page and leave. Search engines and AI crawlers can only read what they receive, so a truncated page can lose its content, links and structured data. The fault is often partial: it may affect only some pages, some browsers, or only requests that ask for Brotli, so it is easy to miss when you test on your own machine.
- Ad or search clickVisitor or crawler requests the page
- HTML deliveredStream is cut off or cannot be decoded
- Form and button renderMissing from the partial HTML
- Lead or saleNever reached
The HTML is cut off before the form, so later steps never happen.
How to check if your site has it
Request the page the way a browser does and compare what the server says with what it sends. Run these from a terminal, and try your most important pages.
# See the headers sent with each encoding
curl -sI -H 'Accept-Encoding: gzip' https://example.com/ | grep -i -E 'HTTP|content-encoding|content-length|transfer-encoding'
curl -sI -H 'Accept-Encoding: br' https://example.com/ | grep -i -E 'HTTP|content-encoding|content-length'
# Let curl decode it. Errors here mean the body is broken
curl -s --compressed -o /dev/null -w '%{http_code} %{size_download}\n' https://example.com/
# Check the HTML ends properly
curl -s --compressed https://example.com/ | tail -c 200
# Try with no compression at all
curl -s -H 'Accept-Encoding: identity' https://example.com/ | wc -c- curl prints errors such as
(61) Unrecognized content-encodingor(23) Failed writing body. - The page does not end with
</html>. - The header shows two encodings, for example
gzip, gzip. - The identity (uncompressed) page works but the gzip or br one does not.
- Results differ between the CDN address and the origin address.
- The Network tab in Chrome DevTools shows the request as failed or the response as empty.
How to fix it
Test the origin directly
Request the server by its own address or with a host override, bypassing the CDN. If it is fine, the CDN or proxy is the cause.
Make only one layer compress
Pick the origin or the CDN. Turn off the other layer's compression for HTML so the body is not compressed twice.
Clear caches
Purge the CDN, page cache and any server cache so no broken copy is served.
Check logs for early exits
Look in the PHP or app error log for fatal errors, memory limits or timeouts that stop output halfway.
Retest with curl
Repeat the commands above for gzip, br and identity.
Stop duplicate compression
If a caching or performance plugin has a GZIP option and your host or CDN already compresses, switch the plugin's option off. Also check for
zlib.output_compressionenabled in PHP together with another compressor.Deactivate plugins to isolate
Deactivate caching and optimisation plugins one at a time and retest with curl. Look for PHP notices or whitespace output before headers in the error log.
Purge caches
Clear the plugin cache, host cache and CDN cache.
Check any proxy in front of the store
Shopify compresses responses itself. If you put a CDN or proxy in front of your domain, make sure it does not re-compress or alter the body.
Review theme and apps
Disable recently added apps or theme edits that inject scripts, then retest. Contact Shopify support if the fault persists on the default domain.
Check your proxy or CDN
Webflow hosting handles compression. If Cloudflare or another proxy sits in front, check its compression and optimisation settings, and test the webflow.io address against your domain.
nginx: one compressor
Make sure
gzip on;is not combined with an upstream that already compresses. Usegzip_proxiedcarefully, and do not setContent-Encodingby hand.Apache: check mod_deflate and mod_brotli
Avoid enabling both for the same content type. Add
Vary: Accept-Encodingso caches store separate copies.Application code
Do not call a compression function if the web server already compresses. Do not set a fixed
Content-Lengthbefore the body is compressed.
gzip on;
gzip_vary on;
gzip_min_length 256;
gzip_types text/html text/css application/javascript application/json image/svg+xml;
# Do not enable this if the upstream or CDN already compresses HTML.How to confirm it's fixed
- curl with
--compressedreturns 200 and no decoding error. - gzip, br and identity requests all return the same page ending in
</html>. - Only one
Content-Encodingvalue appears in the headers. - Chrome loads the page with no
ERR_CONTENT_DECODING_FAILED. - Search Console URL Inspection shows the complete HTML.
- A test form submission and a test purchase journey still work.
How to prevent it happening again
- Document which layer owns compression and leave the others off.
- After changing CDN, host, plugin or server config, run the curl tests on your key pages.
- Keep
Vary: Accept-Encodingon compressed responses. - Watch error logs for early script exits and memory limit errors.
- Recheck after platform or PHP version upgrades.
Broken
- Origin and CDN both compress HTML
- Header says gzip, body does not decode
- Pages end mid-tag
Fixed
- One layer compresses
- Headers match the body
- Every page ends with </html>
How FunnelGuard handles this
FunnelGuard does not check for gzip or Brotli errors or truncated HTML yet. It is a possible future check. Today FunnelGuard runs your real customer journeys in a browser on a schedule and checks each step. If a broken response means a form or button never appears, the journey fails, FunnelGuard re-checks from a second region and sends one alert with a screenshot and a likely cause. That tells you the journey broke, but it does not name compression as the reason.
To watch for this directly, run the curl tests above after every change to your hosting, CDN or caching, and use URL Inspection in Google Search Console on key pages. You can also try FunnelGuard free on 1 site with 2 journeys and daily checks, no card needed.
Questions people ask
Why is my page showing ERR_CONTENT_DECODING_FAILED?
The browser could not unpack the page because the Content-Encoding header does not match the body. The usual cause is double compression, where both the server and a CDN or plugin compress the HTML. Turn compression off in one layer and clear caches.
How do I check if my site uses gzip or Brotli?
Run curl -sI -H 'Accept-Encoding: gzip, br' https://yoursite.com/ and look for a Content-Encoding header. Its value will be gzip or br if compression is on. Browser DevTools shows the same header in the Network tab.
Why is my HTML cut off before the closing tag?
The response probably ended early. Typical causes are a PHP fatal error, a memory limit or timeout, a proxy closing the connection, or a Content-Length that does not match the body. Check error logs and test the origin without the CDN.
Can truncated HTML hurt my SEO?
Yes. Search engines and AI crawlers only see what they receive, so missing content, links or structured data may not be indexed. Pages that fail to decode can also be treated as errors and crawled less.
Should I use gzip or Brotli?
Either works for HTML. Brotli usually makes files smaller, and gzip is supported everywhere. What matters most is that only one layer compresses and the headers match the body.
Why does the page work for me but not for Googlebot?
Your browser may be served a cached or differently encoded copy. A crawler may ask for another encoding and hit a broken path. Test with curl using different Accept-Encoding values and use Search Console URL Inspection.
Does FunnelGuard detect gzip or truncated HTML errors?
Not yet. It is a possible future check. FunnelGuard does run your journeys on a schedule, so a broken page that stops a form or button from working would fail a journey, but it does not name compression as the cause.
Related issues
- SEO-078Wrong Content-Type header (HTML served as text/plain)Fix guide
- SEO-080Timeout before HTML is deliveredFix guide
- SEO-074Intermittent 5xx errors seen by GooglebotFix guide
- SEO-066Money page returns 4xx or 5xxFix guide
- SEO-068Soft 404: error or empty page returned with 200Fix guide
- SEO-067Site down or maintenance mode for crawlers and visitorsFix guide