docs(README): 更新项目文档并添加部署指南
- 在 README.md 中添加了详细的项目结构、快速开始、使用指南、开发指南等内容 - 新增生产环境部署步骤,包括前端和后端的构建
This commit is contained in:
56
docker/caddy/biji-houdaun.caddy
Normal file
56
docker/caddy/biji-houdaun.caddy
Normal file
@@ -0,0 +1,56 @@
|
||||
|
||||
反向代理,后端的反向代理,在/config/caddy.d目录下
|
||||
|
||||
|
||||
xxx.com { # 你的域名
|
||||
|
||||
# 处理预检请求
|
||||
@options method OPTIONS
|
||||
handle @options {
|
||||
header Access-Control-Allow-Origin "*"
|
||||
header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, PATCH, OPTIONS"
|
||||
header Access-Control-Allow-Headers "Content-Type, Authorization"
|
||||
header Access-Control-Allow-Credentials "true"
|
||||
header Access-Control-Max-Age "3600"
|
||||
respond "" 204
|
||||
}
|
||||
|
||||
# 为实际请求添加CORS头部
|
||||
header {
|
||||
Access-Control-Allow-Origin "*"
|
||||
Access-Control-Allow-Credentials "true"
|
||||
}
|
||||
|
||||
|
||||
|
||||
# 反向代理到Gitea服务器的IP和端口
|
||||
reverse_proxy http://ip:8084 { #若是后端与caddy在同一个网络,可以直接指定后端的容器名
|
||||
|
||||
|
||||
# 移除后端返回的 CORS 头(防止冲突)
|
||||
header_down -Access-Control-Allow-Origin
|
||||
header_down -Access-Control-Allow-Methods
|
||||
header_down -Access-Control-Allow-Headers
|
||||
|
||||
|
||||
|
||||
# 传递原始客户端信息
|
||||
header_up X-Real-IP {remote_host}
|
||||
header_up X-Forwarded-For {remote}
|
||||
header_up X-Forwarded-Proto {scheme}
|
||||
|
||||
# 保持连接活跃(提高性能)
|
||||
transport http {
|
||||
keepalive 30s
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# 添加安全头部
|
||||
header {
|
||||
X-Frame-Options "DENY"
|
||||
X-Content-Type-Options "nosniff"
|
||||
Referrer-Policy "no-referrer-when-downgrade"
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user