chenhaozhe
2026-11-10 78389519e546d5b366cea83f67df4016a3f6a290
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*",
  "Gateway": {
    "FileFilter": {
      "Enabled": true,
      "BlockedExtensions": [ ".dll", ".log" ]
    },
    "ErrorPage": {
      "Enabled": true,
      "LogPageEnabled": true,
      "LogPageDirectory": "PageLogs"
    }
  },
  "ReverseProxy": {
    "Routes": {
      "mes-backend": {
        "ClusterId": "mes-backend",
        "CorsPolicy": "frontend-dev",
        "Match": {
          "Path": "/API/{**catch-all}"
        },
        "Transforms": [
          //{ "PathRemovePrefix": "/API" }
        ]
      }
    },
    "Clusters": {
      "mes-backend": {
        "Destinations": {
          "backend": {
            "Address": "http://localhost:81"
          }
        }
      }
    }
    // 注意:YARP 没有 "CorsPolicies" 这个配置节(写了也会被静默忽略)。
    // 路由上的 "CorsPolicy" 只是策略名,真正的策略定义在 Program.cs 的 AddCors(...) 里,
    // 两处名字必须完全一致。
  }
}