我使用 Microsoft C# .NET YARP作为 ASP.NET Core Web API(最新版本)以及 Swagger 和 Kestrel 前面的 API 网关。YARP 用于到许多微服务的内部重定向。
问题:
例如:https://URL/swagger/index.html => 执行 POST FUNCTION => YARP_API_GATEWAY => SERVICE_API_PORT
前任。配置:
"ReverseProxy": {
"Routes": [
{
"RouteId": "Service1",
"ClusterId": "ServiceCluster1",
"Match": {
"Path": "/api/Action1/{**rest}"
},
"Transforms": [
{ "RequestHeadersCopy": "true" },
{ "RequestHeaderOriginalHost": "true" }
]
},
{
"RouteId": "Service2",
"ClusterId": "ServiceCluster2",
"Match": {
"Path": "/api/Action2/{**rest}"
},
"Transforms": [
{ "RequestHeadersCopy": …Run Code Online (Sandbox Code Playgroud)