只适用Caddy V1版本:
*:80 {
gzip
proxy / http://www.hkbn.net
}
接收所有80端口请求并反向代理到www.hkbn.net
http://mail.leeg.cf {
log access_log.log
gzip
proxy / http://192.168.5.99 {
header_upstream Host {host}
header_upstream X-Real-IP {remote}
header_upstream X-Forwarded-For {remote}
header_upstream X-Forwarded-Proto {scheme}
}
}
用户访问mail.leeg.cn时的请求会透明转发到192.168.5.99并保留所有用户端信息
多站点配置实例如下:
http://add.xxx.cf:2333 {
timeouts none
gzip
proxy / http://www.hkbn.net
}
https://bb.xxx.cf {
gzip
tls [email protected]
root /var/www/xxx
}
https://cc.xxx.cf {
gzip
tls /root/add.xxx.cf.crt /root/add.xxx.cf.key
proxy / http://www.abc.net
}