[SOLVED] Err_content_decoding_failed

1. Caddy version (caddy version):

v2.3.0 h1:fnrqJLa3G5vfxcxmOH/+kJOcunPLhSBnjgIvjXV/QTA=

2. How I run Caddy:

ubuntu caddy service
local windows hosts file redirected at caddy domain

a. System environment:

Ubuntu 20.04
PHP 7.4

b. Command:

service caddy start

c. Service/unit/compose file:

# caddy.service
# For using Caddy with a config file.
# Make sure the ExecStart and ExecReload commands are correct
# for your installation.
# See https://caddyserver.com/docs/install for instructions.
# WARNING: This service does not use the --resume flag, so if you
# use the API to make changes, they will be overwritten by the
# Caddyfile next time the service is restarted. If you intend to
# use Caddy's API to configure it, add the --resume flag to the
# `caddy run` command or use the caddy-api.service file instead.

After=network.target network-online.target

ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile


d. My complete Caddyfile or JSON config:

# The Caddyfile is an easy way to configure your Caddy web server.
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace the line below with your
# domain name.

it-svc.com, www.it-svc.com {
	root * /var/www/it-svc.com
	php_fastcgi unix//run/php/php7.4-fpm.sock
	#encode gzip
	encode zstd
	tls internal
	log {
		output file /var/log/caddy/itsvc_access.log {
			roll true # Rotate logs, enabled by default
			roll_size_mb 5 # Set max size 5 MB
			roll_gzip true # Whether to compress rolled files
			roll_local_time true # Use localhost time
			roll_keep 2 # Keep at most 2 log files
			roll_keep_days 7 # Keep log files for 7 days
	@disallowed {
		path /xmlrpc.php
		path *.sql
		path /wp-content/uploads/*.php

	rewrite @disallowed '/index.php'

3. The problem Iā€™m having:

Chrome Edge and firefox return a content decoding error this is chromes result.

4. Error messages and/or full log output:

GET https://www.it-svc.com/ net::ERR_CONTENT_DECODING_FAILED 200

There are no errors in the access log: Headers also show content from underlying wordpress site

5. What I already tried:

Tried turning on and off encoding
Tried changing from gzip to zstd and without encoding line at all.
Also tried adding https to start of domain www and non-www

6. Links to relevant resources:

What do you see when you make the request with curl -v instead of in a browser?

root@ubuntu-s-2vcpu-4gb-nyc3-01:/etc/systemd/network# curl -v --header "Host: www.it-svc.com" --head
*   Trying
* Connected to ( port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS alert, internal error (592):
* error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error
* Closing connection 0
curl: (35) error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error

So as a conclusion to this issue.

This turned out to be a content encoding error of the output of wordpress w/ php

It required me to go into the php.ini for the php-fpm server and turn on

zlib.output_compression = On

This topic was automatically closed after 30 days. New replies are no longer allowed.