Caddy 常见配置详解

完整配置

text.example.com:80 {
redir https://text.example.com
}
https://text.example.com {
  tls test@example.com
  @allow {
     remote_ip forwarded 192.168.0.1/24
}
  handle @allow {
  reverse_proxy http://spingBoot:8000
}
  respond "<h1>You are attempting to access protected resources!</h1>" 403
}

http 跳转 https配置

text.example.com:80 {
redir https://text.example.com
}

反向代理加白名单配置

https://text.example.com {
 # 自动 https
  tls test@example.com
  @allow {
     remote_ip forwarded 192.168.0.1/24
}
  handle @allow {
  reverse_proxy http://spingBoot:8000
}
  respond "<h1>You are attempting to access protected resources!</h1>" 403
}

反向代理无白名单配置

 https://text.example.com {
 # 自动 https
  tls test@example.com
  reverse_proxy http://spingBoot:8000
}
posted @ 2022-09-22 11:35  li66  阅读(618)  评论(0编辑  收藏  举报