当应用程序发送401时,Azure应用程序网关抛出502 [英] Azure application gateway throws 502 when application sends 401

查看:132
本文介绍了当应用程序发送401时,Azure应用程序网关抛出502的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Azure应用程序网关显示502 bad gateway error,而应用程序返回401500 errors.它应该发送应用程序发送的所有内容,但默认情况下会发送502.知道发生了什么,有任何配置或代码更改建议吗?

Azure application gateway displays 502 bad gateway error, while application returns 401 or 500 errors. It should send whatever the application sends but by default it sends 502. Any idea what happen and any configuration or code change suggestions?

我们正在将node js用于我们的API服务.当客户端尝试不使用任何auth header到达端点时,该服务将返回401 error.通过应用程序网关时,此错误将转换为502.

We are using node js for our API service. When a client tries to hit the endpoint without any auth header, then the service will return 401 error. This error is transformed into 502 when it's passing the App gateway.

推荐答案

常规工作流程

当应用程序网关收到的状态码大于399时,它将认为服务器存在问题,并将服务器从池中删除.一段时间后,它将检查应用程序状态,如果返回的状态代码小于400,则将服务器添加到池中.

When application gateway receives a status code greater than 399, then it will consider there were some issues with the servers and it will remove the server from the pool. After sometime it will check the application status, if it is returning status code lesser than 400 then it add the server to pool.

默认情况下,应用程序网关将配置为通过发出HTTP/HTTPS请求来检查应用程序的运行状况.

By default application gateway will be configured to check the app health by making a HTTP/HTTPS request.

原因

应用程序可能遇到任何错误,或者任何身份验证错误都可能导致不同的错误代码.这可能导致应用程序网关导致502错误.

Application may encountered any errors or any authentication errors may result in different error codes. This might caused the application gateway result in 502 error.

探针

我们可以配置一个特殊的文件/端点来检查应用程序/数据库的运行状况.此配置应该在探针文件中.

We can configure a special file/end point to check the application/database health. This configuration should be in the probe file.

有用的资源

https://azure .microsoft.com/en-us/documentation/articles/application-gateway-create-probe-classic-ps/

https://azure.microsoft.com /en-us/documentation/articles/application-gateway-probe-overview/

希望有帮助!

这篇关于当应用程序发送401时,Azure应用程序网关抛出502的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆