1. Caddy version (caddy version
):
2.1.1
2. How I run Caddy:
a. System environment:
Amazon Linux 2
b. Command:
service caddy start
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target
[Service]
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/config.json
ExecReload=/usr/bin/caddy reload --config /etc/caddy/config.json
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
c. Service/unit/compose file:
./xcaddy build --with github.com/caddy-dns/cloudflare --with github.com/gamalan/caddy-tlsredis
d. My complete Caddyfile or JSON config:
{
"admin": {
"disabled": false,
"listen": "0.0.0.0:2020",
"config": {
"persist": true
}
},
"logging": {
"sink": {
"writer": {
"output": "file",
"filename": "/tmp/caddy-Go.log"
}
},
"logs": {
"default": {
"writer": {
"output": "file",
"filename": "/tmp/caddy-tmp.log"
},
"encoder": {
"format": "json"
},
"level": "WARN"
}
}
},
"storage": {
"address": "sessions-and-cache.xxxxx.clustercfg.usw2.cache.amazonaws.com:6379",
"aes_key": "redistls-01234567890-caddytls-32",
"db": 1,
"host": "sessions-and-cache.xxxxx.clustercfg.usw2.cache.amazonaws.com",
"key_prefix": "caddytls",
"module": "redis",
"password": "",
"port": "6379",
"timeout": 5,
"tls_enabled": false,
"tls_insecure": true,
"value_prefix": "caddy-storage-redis"
},
"apps": {
"tls": {
"automation": {
"policies": [{
"subjects": ["*.mydomain.com"],
"issuer": {
"module": "acme",
"email": "soporte@mydomain.com",
"challenges": {
"dns": {
"provider": {
"name": "cloudflare",
"api_token": "xxx"
}
}
}
},
"on_demand": false
},
{
"issuer": {
"module": "acme",
"email": "soporte@mydomain.com"
},
"on_demand": true
}],
"on_demand": {
"rate_limit": {
"interval": "5m",
"burst": 100
},
"ask": "http://certs.mydomain.com/delegated.php"
}
}
},
"http": {
"http_port": 80,
"https_port": 443,
"servers": {
"tiendas": {
"listen": [":80",":443"],
"max_header_bytes": 41943040,
"routes": [{
"match": [{
"host": ["guiacanaveral.com"]
}],
"handle": [{
"handler": "encode",
"encodings": {
"gzip": {},
"zstd": {}
}
},
{
"handler": "reverse_proxy",
"upstreams": [{
"dial": "172.31.53.124:80"
}]
}]
},
{
"match": [{
"host": ["admintienda.guiacanaveral.com"]
}],
"handle": [{
"handler": "encode",
"encodings": {
"gzip": {},
"zstd": {}
}
},
{
"handler": "reverse_proxy",
"upstreams": [{
"dial": "172.31.60.234:80"
}]
}]
},
{
"match": [{
"host": ["api.guiacanaveral.com"]
}],
"handle": [{
"handler": "encode",
"encodings": {
"gzip": {},
"zstd": {}
}
},
{
"handler": "reverse_proxy",
"upstreams": [{
"dial": "172.31.63.108:80"
}]
}]
},
{
"group": "grupo1",
"match": [{
"host": ["certs.guiacanaveral.com"]
}],
"handle": [{
"handler": "reverse_proxy",
"transport": {
"protocol": "fastcgi",
"root": "/var/www/html/"
},
"upstreams": [{
"dial": "unix//var/run/php.sock"
}]
}],
"terminal": true
},
{
"group": "grupo1",
"match": [{
"host": ["*.mydomain.com"]
}],
"handle": [{
"handler": "encode",
"encodings": {
"gzip": {},
"zstd": {}
}
},
{
"handler": "reverse_proxy",
"upstreams": [{
"dial": "172.31.4.60:80"
}]
}],
"terminal": true
},
{
"group": "grupo1",
"handle": [{
"handler": "encode",
"encodings": {
"gzip": {},
"zstd": {}
}
},
{
"handler": "reverse_proxy",
"upstreams": [{
"dial": "172.31.4.60:80"
}]
}],
"terminal": true
}]
}
}
}
}
}
3. The problem I’m having:
catch-all route previously worked in caddy 2.0.0
and now doesn`t.
4. Error messages and/or full log output:
2020/07/13 13:44:27 http: TLS handshake error from 127.0.0.1:37142: EOF
5. What I already tried:
I tried changing the route block from :
{
"group": "grupo1",
"handle": [{
"handler": "encode",
"encodings": {
"gzip": {},
"zstd": {}
}
},
{
"handler": "reverse_proxy",
"upstreams": [{
"dial": "172.31.4.60:80"
}]
}],
"terminal": true
}
to
{
"group": "grupo1",
"match": [{
"host": ["*"]
}],
"handle": [{
"handler": "encode",
"encodings": {
"gzip": {},
"zstd": {}
}
},
{
"handler": "reverse_proxy",
"upstreams": [{
"dial": "172.31.4.60:80"
}]
}],
"terminal": true
}
Neither way works