Caddyfile 776 B

12345678910111213141516171819202122232425262728293031
  1. love.hdlife.me {
  2. # Basic Auth - 用户名和 bcrypt 哈希从外部文件导入
  3. # 生成命令(在服务器上执行):
  4. # docker run --rm caddy:2-alpine caddy hash-password --plaintext 'your_password'
  5. # 然后将用户名和哈希写入 htpasswd 文件,格式为:username $2a$14$xxxxx
  6. basic_auth * {
  7. import /etc/caddy/htpasswd
  8. }
  9. # 反向代理到 byreal-table 服务
  10. reverse_proxy byreal-table:3000
  11. # 日志配置
  12. log {
  13. output file /var/log/caddy/access.log {
  14. roll_size 10MB
  15. roll_keep 5
  16. }
  17. }
  18. # 安全响应头
  19. header {
  20. # 移除 Server 头
  21. -Server
  22. # 安全头
  23. Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
  24. X-Content-Type-Options "nosniff"
  25. X-Frame-Options "DENY"
  26. X-XSS-Protection "1; mode=block"
  27. }
  28. }