feat: Caddyfile 支持环境变量 — DOMAIN/ACME_EMAIL 通过 .docker.env 配置
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,36 +1,32 @@
|
||||
# Caddyfile — Cyrene AI 助手平台反向代理
|
||||
# Caddy version: 2.x
|
||||
# 环境变量: DOMAIN, ACME_EMAIL
|
||||
|
||||
{
|
||||
# 全局配置
|
||||
email {$ACME_EMAIL:admin@localhost}
|
||||
admin off
|
||||
}
|
||||
|
||||
# 默认站点
|
||||
:80 {
|
||||
# 访问日志
|
||||
# 站点(DOMAIN 未设置时回退到 :80 HTTP)
|
||||
{$DOMAIN::80} {
|
||||
log {
|
||||
output stdout
|
||||
format json
|
||||
}
|
||||
|
||||
# 安全头
|
||||
header {
|
||||
X-Content-Type-Options "nosniff"
|
||||
X-Frame-Options "DENY"
|
||||
X-XSS-Protection "1; mode=block"
|
||||
Referrer-Policy "strict-origin-when-cross-origin"
|
||||
# 生产环境启用 HSTS
|
||||
# 生产环境有域名时取消注释
|
||||
# Strict-Transport-Security "max-age=31536000; includeSubDomains"
|
||||
Strict-Transport-Security "max-age=31536000; includeSubDomains"
|
||||
}
|
||||
|
||||
# WebSocket 路由 (需放在 API 路由之前以匹配优先级)
|
||||
# WebSocket 路由
|
||||
handle_path /ws/* {
|
||||
reverse_proxy gateway:8080 {
|
||||
# WebSocket 支持
|
||||
header_up Host {http.request.host}
|
||||
}
|
||||
reverse_proxy gateway:8080
|
||||
}
|
||||
|
||||
# API 路由 → Gateway
|
||||
@@ -42,9 +38,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
# 前端静态文件 (未来可改为反代到 frontend 容器)
|
||||
# 前端静态文件
|
||||
handle {
|
||||
# 默认响应 — 前端尚未部署时使用
|
||||
respond "Cyrene AI Platform — Frontend coming soon." 200
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user