-
I'm trying to use YARP as a means to slowly transition .NET Framework MVC into .NET 7. The .NET 7 will be the front facing app and the YARP middleware by default proxy everything into the old site at it's inception. This part is working just fine. As I start rewriting different pages in the .NET 7, I'd like it to NOT redirect those pages. What do I put as a cluster destination for such a setup? Note that the new .NET 7 MVC app and the YARP is being implemented in the same app. We can alternative just have YARP as a separate application but I figured it would more sense to have this setup since we're doing this just for the transition development. Example of the config I have is below. Here, I have a "ReverseProxy": {
"Routes": {
"route1": {
"ClusterId": "cluster1",
"Match": {
"Path": "/home/privacy",
"Order": 1
}
},
"route2": {
"ClusterId": "cluster2",
"Match": {
"Path": "{**catch-all}",
"Order": 999
}
}
},
"Clusters": {
"cluster1": {
"Destinations": {
"destination1": {
"Address": "??"
}
}
},
"cluster2": {
"Destinations": {
"destination1": {
"Address": "https://oldsite.com"
}
}
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
You should only define routes that you do want to proxy in the YARP config. In your case, you should be able to simply remove the |
Beta Was this translation helpful? Give feedback.
-
Thanks. I still need to figure out how to have local paths in the yarp project. Since the whole point is to incrementally migrate a legacy WebForms site to angular with .net 8.0 for the web api. |
Beta Was this translation helpful? Give feedback.
You should only define routes that you do want to proxy in the YARP config.
By using a lower priority (higher number) for those YARP routes, routing will prefer your local controllers if they exist.
In your case, you should be able to simply remove the
cluster1
definition, and let routing pickcluster2
only if that route does not have an implementation in the same project yet.