# Caddy 配置文件 - 前端静态文件 + 后端 API 反向代理 # 最小化配置,符合 Caddy 2.x 最佳实践 { log { output stdout format console } } :8080 { # 静态资源缓存 @static { file path *.js *.css *.png *.jpg *.jpeg *.gif *.svg *.ico *.woff *.woff2 *.ttf *.eot } header @static Cache-Control "public, max-age=31536000, immutable" # HTML 不缓存 @html { file path *.html } header @html Cache-Control "no-cache" # 安全头 header { X-Content-Type-Options "nosniff" X-Frame-Options "SAMEORIGIN" Referrer-Policy "strict-origin-when-cross-origin" } # API 反向代理 handle /api/* { reverse_proxy localhost:9001 { header_up X-Real-IP {remote_host} header_up X-Forwarded-For {remote_host} header_up X-Forwarded-Proto {scheme} } } # 后端 API 反向代理 handle /jingrow/* { reverse_proxy localhost:9001 { header_up X-Real-IP {remote_host} header_up X-Forwarded-For {remote_host} header_up X-Forwarded-Proto {scheme} } } # 前端静态文件 + SPA 路由支持 handle { root * apps/jingrow/frontend/dist encode gzip zstd try_files {path} /index.html file_server } }