diff --git a/backend/api-gateway/kong.yml b/backend/api-gateway/kong.yml index 30be6130..9ff8c2d6 100644 --- a/backend/api-gateway/kong.yml +++ b/backend/api-gateway/kong.yml @@ -270,6 +270,101 @@ services: - /api/v1/co-managed strip_path: false + + # =========================================================================== + # RWA 2.0 Services - 新架构微服务 + # =========================================================================== + + # --------------------------------------------------------------------------- + # Contribution Service 2.0 - 算力服务 + # --------------------------------------------------------------------------- + - name: contribution-service-v2 + url: http://192.168.1.111:3020 + routes: + - name: contribution-v2-api + paths: + - /api/v2/contribution + strip_path: false + - name: contribution-v2-health + paths: + - /api/v2/contribution/health + strip_path: false + + # --------------------------------------------------------------------------- + # Mining Service 2.0 - 挖矿服务 + # --------------------------------------------------------------------------- + - name: mining-service-v2 + url: http://192.168.1.111:3021 + routes: + - name: mining-v2-api + paths: + - /api/v2/mining + strip_path: false + - name: mining-v2-health + paths: + - /api/v2/mining/health + strip_path: false + + # --------------------------------------------------------------------------- + # Trading Service 2.0 - 交易服务 + # --------------------------------------------------------------------------- + - name: trading-service-v2 + url: http://192.168.1.111:3022 + routes: + - name: trading-v2-api + paths: + - /api/v2/trading + strip_path: false + - name: trading-v2-health + paths: + - /api/v2/trading/health + strip_path: false + + # --------------------------------------------------------------------------- + # Mining Admin Service 2.0 - 挖矿管理后台服务 + # --------------------------------------------------------------------------- + - name: mining-admin-service + url: http://192.168.1.111:3023 + routes: + - name: mining-admin-api + paths: + - /api/v2/mining-admin + strip_path: false + - name: mining-admin-health + paths: + - /api/v2/mining-admin/health + strip_path: false + + # --------------------------------------------------------------------------- + # Auth Service 2.0 - 用户认证服务 + # --------------------------------------------------------------------------- + - name: auth-service-v2 + url: http://192.168.1.111:3024 + routes: + - name: auth-v2-api + paths: + - /api/v2/auth + strip_path: false + - name: auth-v2-health + paths: + - /api/v2/auth/health + strip_path: false + + # --------------------------------------------------------------------------- + # Mining Wallet Service 2.0 - 挖矿钱包服务 + # --------------------------------------------------------------------------- + - name: mining-wallet-service + url: http://192.168.1.111:3025 + routes: + - name: mining-wallet-api + paths: + - /api/v2/mining-wallet + strip_path: false + - name: mining-wallet-health + paths: + - /api/v2/mining-wallet/health + strip_path: false + # ============================================================================= # Plugins - 全局插件配置 # ============================================================================= diff --git a/frontend/mining-admin-web/nginx/madmin.szaiai.com.conf b/frontend/mining-admin-web/nginx/madmin.szaiai.com.conf index b60f5cc4..f00ebf13 100644 --- a/frontend/mining-admin-web/nginx/madmin.szaiai.com.conf +++ b/frontend/mining-admin-web/nginx/madmin.szaiai.com.conf @@ -60,7 +60,37 @@ server { add_header X-XSS-Protection "1; mode=block" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; - # 反向代理到 Docker 容器 + # ========================================================================== + # API 代理到 mining-admin-service (端口 3023) + # ========================================================================== + location /api/ { + proxy_pass http://127.0.0.1:3023/; + proxy_http_version 1.1; + 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; + proxy_set_header Authorization $http_authorization; + + # 超时设置 + proxy_connect_timeout 60s; + proxy_send_timeout 60s; + proxy_read_timeout 60s; + + # CORS 头 (处理预检请求) + if ($request_method = 'OPTIONS') { + add_header 'Access-Control-Allow-Origin' '$http_origin' always; + add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS' always; + add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, Accept' always; + add_header 'Access-Control-Allow-Credentials' 'true' always; + add_header 'Access-Control-Max-Age' 1728000; + add_header 'Content-Type' 'text/plain charset=UTF-8'; + add_header 'Content-Length' 0; + return 204; + } + } + + # 反向代理到 Docker 容器 (Next.js 前端) location / { proxy_pass http://127.0.0.1:3100; proxy_http_version 1.1; @@ -78,15 +108,6 @@ server { proxy_read_timeout 60s; } - # 健康检查端点 - location /api/health { - proxy_pass http://127.0.0.1:3100; - proxy_http_version 1.1; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - access_log off; - } - # 静态资源缓存 location /_next/static { proxy_pass http://127.0.0.1:3100;