gpt4 book ai didi

azure - 如何修复警告 : "Application evaluated unhealthy due to redirection." on Azure Health Check Feature

转载 作者:行者123 更新时间:2023-12-03 00:22:47 25 4
gpt4 key购买 nike

我在其中一个应用程序服务内的 Azure 仪表板上运行“诊断并解决问题”,然后收到此严重风险警报:“由于重定向,应用程序评估不健康。”。

建议采取的措施是:

If the application has HTTP to HTTPS redirectoin, consider one of the following solutions.

a. Enable 'HTTPs Only' from the TLS/SSL settings blade for the respective App Service. This will force health check pings to over 443.

b. Modify the Application logic/ad a URL Rewrite rule so that requests from the user agents – ReadyForRequest/1.0+(HealthCheck) & HealthCheck/1.0 are not redirected.

我已经按照 (a) 点的建议启用了“仅限 HTTPs”,但我不知道如何执行 (b) 点。如何修改应用程序逻辑/广告 URL 重写规则,以便来自用户代理的请求 – ReadyForRequest/1.0+(HealthCheck)HealthCheck/1.0 不会被重定向?

目前,我启用了运行状况检查并将运行状况检查路径设置为 /

感谢之前的任何帮助。

enter image description here

最佳答案

我下载了官方示例,并对代码进行了一些更改,希望对您有用。

示例代码 --- .net core 3.X(HealthChecksSample)

方法 1。

由于代码位于.net core中,因此我首先建议在Startup.cs中配置重写。

public void Configure(IApplicationBuilder app)
{
app.UseHealthChecks("/");

app.UseRouting();

app.MapWhen(
ctx => ctx.Request.Path.StartsWithSegments("/"),
appBuilder =>
{
appBuilder.UseMiddleware<HealthCheckMiddleware>();
}
);

app.UseEndpoints(endpoints =>
{
endpoints.MapHealthChecks("/");

endpoints.MapGet("/{**path}", async context =>
{
await context.Response.WriteAsync(
"Navigate to /health to see the health status.");
});
});
}

它对我有用,无论是在本地还是 azure 网络应用程序中。

enter image description here

我将在您的另一篇文章中添加方法 2

关于azure - 如何修复警告 : "Application evaluated unhealthy due to redirection." on Azure Health Check Feature,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65627278/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com