Caddyfile 1.6 KB

123456789101112131415161718192021222324252627282930313233
  1. # 反向代理配置
  2. #
  3. # Reverse proxy configuration
  4. #
  5. # DSH 反向代理:basic auth + 转发到容器内 dsh 127.0.0.1:3080
  6. #
  7. # DSH reverse proxy: basic auth + forwarding to the in-container dsh at 127.0.0.1:3080
  8. #
  9. # 注意:
  10. # - 容器内必须监听 0.0.0.0(Docker 端口映射 DNAT 到容器 eth0,bind loopback 会拒接映射流量)
  11. # - DSH 特权 API(settings.*/credentials.*)只接受 loopback 来源(防 DNS rebinding),
  12. # 必须把 Host/Origin 改写为 127.0.0.1:3080 使 dsh 视为本机来源;
  13. # Origin 必须与改写后 Host 同源,否则 fence 的 Origin 检查仍 403
  14. # - bcrypt 哈希含 $ 字符,必须经环境变量注入({$DSH_AUTH_HASH}),不能直写本文件
  15. # - http:// 前缀显式声明纯 HTTP 站点,禁用 auto-HTTPS/本地 CA
  16. #
  17. # Notes:
  18. # - Must listen on 0.0.0.0 inside the container (Docker port mapping DNATs to container eth0; binding loopback rejects mapped traffic)
  19. # - DSH privileged APIs (settings.*/credentials.*) accept only loopback origins (anti-DNS-rebinding),
  20. # Host/Origin must be rewritten to 127.0.0.1:3080 so dsh treats it as a local origin;
  21. # Origin must match the rewritten Host, otherwise the fence's Origin check still returns 403
  22. # - bcrypt hashes contain $, so they must be injected via environment variable ({$DSH_AUTH_HASH}), never written inline
  23. # - The http:// prefix explicitly declares a plain-HTTP site, disabling auto-HTTPS/local CA
  24. http://:3081 {
  25. basic_auth {
  26. {$DSH_AUTH_USER} {$DSH_AUTH_HASH}
  27. }
  28. reverse_proxy 127.0.0.1:3080 {
  29. header_up Host 127.0.0.1:3080
  30. header_up Origin http://127.0.0.1:3080
  31. }
  32. }