简体   繁体   English

Azure 应用服务上的容器化 Spring Boot Web 应用由于 302 错误而导致运行状况检查失败

[英]Containerized Spring Boot web app on Azure app service has health check failing due to 302 error

I have a containerized Java Spring Boot web app deployed using Azure App Service.我有一个使用 Azure 应用服务部署的容器化 Java Spring Boot Web 应用程序。 I have enabled Actuator Health Check endpoint which is accessible at https:///actuator/health.我已启用可在 https:///actuator/health 访问的执行器健康检查端点。

I enabled Health Check for the service and it cribs that 'Your app is unhealthy'.我为该服务启用了健康检查,但它提示“您的应用程序不健康”。 Following statements keep on appearing in the log:以下语句不断出现在日志中:

2021-07-26T06:52:44.592883929Z 172.16.0.1 - [26/Jul/2021:06:52:44 +0000] GET HTTP/1.1 "GET /actuator/health HTTP/1.1" 302 154 0.000 "-" "HealthCheck/1.0" "-"

2021-07-26T06:52:45.436822668Z 172.16.0.1 - [26/Jul/2021:06:52:45 +0000] GET HTTP/1.1 "GET /actuator/health HTTP/1.1" 302 154 0.000 "-" "ReadyForRequest/1.0 (HealthCheck)" "-"

2021-07-26T06:52:51.107134976Z 172.16.0.1 - [26/Jul/2021:06:52:51 +0000] GET HTTP/1.1 "GET /actuator/health HTTP/1.1" 302 154 0.000 "-" "HealthCheck/1.0" "-"

2021-07-26T06:52:51.124Z WARN  - Container for <instance> site <application-name> is unhealthy, recycling site.

I have set 'HTTPS Only' in the TLS/SSL settings as well.我也在 TLS/SSL 设置中设置了“仅 HTTPS”。 When I ran 'Diagnose and solve problems' it didn't give any problems with Health Check.当我运行“诊断和解决问题”时,它没有给健康检查带来任何问题。

What should I do?我应该怎么办?

Thanks.谢谢。

The Healthcheck URL needs to return a success status code (200-299), otherwise App Services will consider it failed. Healthcheck URL 需要返回一个成功状态码(200-299),否则应用服务会认为它失败。 Also, it works only on HTTP, iirc.此外,它仅适用于 HTTP、iirc。

If your app has a redirect to https built-in you should make sure to whitelist the Healthcheck user agent so the healthcheck url does not redirect and returns a success status code instead.如果您的应用程序内置了到 https 的重定向,您应该确保将 Healthcheck 用户代理列入白名单,以便 healthcheck url 不会重定向并返回成功状态代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM