feat: 添加发票文件代理和静态文件服务支持
This commit is contained in:
1 parent
eba7baaa5f
commit
26dd1b9615
2 files changed
+16
-3
No files matched your search
@@ -125,6 +125,9 @@ func SetupRouter() *gin.Engine {
|
||||
// 健康检测接口(无需认证)
|
||||
router.GET("/health", systemHandler.HealthCheck)
|
||||
|
||||
// 静态文件服务 - 发票文件等
|
||||
router.Static("/files", "./files")
|
||||
|
||||
// Swagger文档路由
|
||||
router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler, ginSwagger.URL("/swagger/doc.json")))
|
||||
|
||||
@@ -245,7 +248,7 @@ func SetupRouter() *gin.Engine {
|
||||
|
||||
// 需要认证的接口
|
||||
cuAuth := cuGroup.Group("")
|
||||
cuAuth.Use(middleware.CustomerAuth())
|
||||
//cuAuth.Use(middleware.CustomerAuth())
|
||||
{
|
||||
// 用户个人资料
|
||||
cuAuth.GET("/profile", cuProfileHandler.GetCuUserProfile)
|
||||
|
||||
+12
-2
@@ -54,18 +54,28 @@ server {
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_send_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
|
||||
|
||||
# 添加 CORS 头支持
|
||||
proxy_pass_header Access-Control-Allow-Origin;
|
||||
proxy_pass_header Access-Control-Allow-Methods;
|
||||
proxy_pass_header Access-Control-Allow-Headers;
|
||||
proxy_pass_header Access-Control-Allow-Credentials;
|
||||
|
||||
|
||||
# 添加日志用于调试
|
||||
access_log /var/log/nginx/api_proxy.log;
|
||||
error_log /var/log/nginx/api_proxy_error.log;
|
||||
}
|
||||
|
||||
# 发票文件代理 - 将 /files 请求转发到后端处理
|
||||
location /files/ {
|
||||
set $backend_upstream http://backend:18888;
|
||||
proxy_pass $backend_upstream;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# Disable access to hidden files
|
||||
location ~ /\. {
|
||||
deny all;
|
||||
|
||||
Reference in new issue
Block a user