os: Ubuntu16.04
Caddy:0.11
nginx:1.14.1
Host A: 172.18.0.1, caddy1(reverse proxy, as front)
Host B: 172.18.0.2, caddy2(backend with https, as backend)
Host C: 172.18.0.3, nginx(backend with https and without no default_server option, as backend)
caddy1:
www.domain1.com {
proxy / https://172.18.0.2 {
insecure_skip_verify
transparent
}
header / -Server
tls {
dns cloudflare
}
}
www.domain2.com {
proxy / https://172.18.0.3 {
insecure_skip_verify
transparent
}
header / -Server
tls {
dns cloudflare
}
}
caddy2:
www.domain1.com {
root /var/www
index index.html
header / -Server
tls {
dns cloudflare
}
}
nginx:
server {
listen 80 ;
listen [::]:80;
server_name www.domain2.com;
root /var/www;
#ssl
listen 443;
listen [::]:443;
.....
}
results:
visit https://www.domain1.com
from caddy1, it will retrun error 502 Bad Gateway
visit https://www.domain1.com
from caddy2. it works fine and return 200
visit https://www.domain2.com
from caddy1 or nginx, it works fine and return 200
now, If I change caddy1:
and add host record to caddy1 hosts file
echo "172.18.0.2 www.domain1.com" > /etc/hosts
and change caddy1 Caddyfile to
www.domain1.com {
proxy / https://www.domain1.com {
insecure_skip_verify
transparent
}
header / -Server
tls {
dns cloudflare
}
}
www.domain2.com {
proxy / https://172.18.0.3 {
insecure_skip_verify
transparent
}
header / -Server
tls {
dns cloudflare
}
}
results:
visit https://www.domain1.com
from caddy1 or caddy2 , it works fine and return 200
visit https://www.domain2.com
from caddy1 or nginx, it works fine and return 200
so is it a bug? it only happen when backend is caddy.