Hi @Kuler Master ,
My question is, how we can mix these two technologies in a single domain www.xyz.com without having subdomains? Any suggestion is welcome.
Using IIS Reverse proxy or Yarp, both of them could achieve your requirement. If you are using the Yarp, you could create a front-end asp.net core application, then put the yarp rule inside it. The rule contains two conditions, which will rewrite the url to different application as you wish, like front-end to blazor's application, other url to old WebForms. For example: 1.Create a new asp.net core application and Install Yarp.ReverseProxy package from Nuget 2.Add usage in the application
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddReverseProxy()
.LoadFromConfig(builder.Configuration.GetSection("ReverseProxy"));
var app = builder.Build();
app.MapReverseProxy();
app.Run();
3.Modify the appsettings.json like below: If the url contain the admin, it will go to the webform url, if the url doesn't contain anything it will go to blazor.
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"ReverseProxy": {
"Routes": {
"route1": {
"ClusterId": "cluster1",
"Order": 100, // Lower numbers have higher precedence
"Match": {
"Path": "admin/{**catch-all}"
}
},
"minimumroute": {
// Matches anything and routes it to www.example.com
"ClusterId": "minimumcluster",
"Order": 200, // Lower numbers have higher precedence
"Match": {
"Path": "{**catch-all}"
}
}
},
"Clusters": {
"cluster1": {
"Destinations": {
"destination1": {
"Address": "https://webform.com/"
}
}
},
"minimumcluster": {
"Destinations": {
"example.com": {
"Address": "http://www.blazor.com/"
}
}
}
}
}
}
More details, about how yarp works, you could refer to this article(https://microsoft.github.io/reverse-proxy/articles/getting-started.html) and this MSFT document(https://learn.microsoft.com/en-us/aspnet/core/migration/inc/overview?view=aspnetcore-8.0).
---If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.