繁体   English   中英

具有多个 web 应用程序的 Yarp 配置

[英]Yarp Configuration with multiple web applications

我有 2 个 web(不是 api,假设是剃须刀)应用程序。 我试图将它们置于 Yarp 反向代理之后。

这是我的配置:

 "Yarp": {
"Routes": {
  "web-route1": {
    "ClusterId": "web-cluster1",
    "Match": {
      "Path": "/web1/{**catch-all}"
    },
    "Transforms": [
      { "PathPrefix": "/web1" }
    ]
  },
  "web-route2": {
    "ClusterId": "web-cluster2",
    "Match": {
      "Path": "/web2/{**catch-all}"
    },
    "Transforms": [
      { "PathPrefix": "/web2" }
    ]
  }
},
"Clusters": {
  "web-cluster1": {
    "Destinations": {
      "destination1": {
        "Address": "http://localhost:5135/"
      }
    }
  },
  "web-cluster2": {
    "Destinations": {
      "destination1": {
        "Address": "http://localhost:5022/"
      }
    }
  }

}

假设 Yarp 应用位于 http://localhost:5000。 目标是让应用程序相应地响应 http:http://localhost:5000/web1 和 http://localhost:5000/web2。

不用说它不起作用。 谁有成功的经验?

我尝试了适用于单个应用程序的 PathRemovePrefix,但它显然删除了关键前缀。

改变这个

"Transforms": [
  { "PathPrefix": "/web2" }
]

"Transforms": [
  { "PathPrefix": "{**catch-all}" }
]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM