[英]Yarp Configuration with multiple web applications
I have 2 web (not api, let's assume razor) applications.我有 2 个 web(不是 api,假设是剃须刀)应用程序。 I'm trying to put them behind Yarp reverse proxy.
我试图将它们置于 Yarp 反向代理之后。
Here's my config:这是我的配置:
"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/"
}
}
}
}
Let's say Yarp app sits at http://localhost:5000.假设 Yarp 应用位于 http://localhost:5000。 The goal is to have apps respond at http: http://localhost:5000/web1 and http://localhost:5000/web2 correspondingly.
目标是让应用程序相应地响应 http:http://localhost:5000/web1 和 http://localhost:5000/web2。
Needless to say it doesn't work.不用说它不起作用。 Anyone had successful experience?
谁有成功的经验?
I tried PathRemovePrefix which works for a single app but it obviously removes the crucial prefix.我尝试了适用于单个应用程序的 PathRemovePrefix,但它显然删除了关键前缀。
Change this改变这个
"Transforms": [
{ "PathPrefix": "/web2" }
]
TO到
"Transforms": [
{ "PathPrefix": "{**catch-all}" }
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.