Hi @melon NG ,
According to your description, I suggest you could consider writing a custom middleware to achieve your requirement. This middleware will check every request's host name and path value, if it find the host name is localhost and it wants to access the specific controller, then you could directly return the response.
app.Use(async (context, next) =>
{
if (context.Request.Host.Host.ToLower() != "localhost" && context.Request.Path.Value.Contains("WeatherForecast"))
{
await context.Response.WriteAsync("test");
}
else
{
await next.Invoke();
}
});
More details about how to use middleware, you could refer to this article.