Azure 流量管理器使用自定义请求 header
Azure traffic manager to use custom request header
是否可以将 Azure 流量管理器配置为轮询需要授权的端点 header?我们为健康检查开发的端点启用了身份验证,需要在请求中传递凭据 header。
目前流量管理器无法探测身份验证墙后面的 URI。 Basic HTTP authentication 也是如此。
即如果您使用重定向进行响应,
HTTP/1.1 302 Found
Location: https://token.service
流量管理器会将您的端点标记为不健康,因为它需要 200 OK
返回。
您需要一个不需要身份验证的 page/controller/route/whathaveyou,并且 returns 200 OK
返回到流量管理器探测器。
例如http://example.com/health
将您所有的健康逻辑放在那里 - 例如,您可以检查您的数据库和 Redis 缓存是否健康,然后 return 200 OK
,否则 return 5xx
.
来自https://azure.microsoft.com/en-gb/documentation/articles/traffic-manager-monitoring/:
Note:
流量管理器仅在 return 消息为 200 OK 时才认为端点在线。当发生以下任何事件时,端点不健康:
- A non-200 response is received (including a different 2xx code, or a 301/302 redirect)
- 请求客户端身份验证
- 超时(超时阈值为10秒)
- 无法连接
是否可以将 Azure 流量管理器配置为轮询需要授权的端点 header?我们为健康检查开发的端点启用了身份验证,需要在请求中传递凭据 header。
目前流量管理器无法探测身份验证墙后面的 URI。 Basic HTTP authentication 也是如此。
即如果您使用重定向进行响应,
HTTP/1.1 302 Found
Location: https://token.service
流量管理器会将您的端点标记为不健康,因为它需要 200 OK
返回。
您需要一个不需要身份验证的 page/controller/route/whathaveyou,并且 returns 200 OK
返回到流量管理器探测器。
例如http://example.com/health
将您所有的健康逻辑放在那里 - 例如,您可以检查您的数据库和 Redis 缓存是否健康,然后 return 200 OK
,否则 return 5xx
.
来自https://azure.microsoft.com/en-gb/documentation/articles/traffic-manager-monitoring/:
Note:
流量管理器仅在 return 消息为 200 OK 时才认为端点在线。当发生以下任何事件时,端点不健康:
- A non-200 response is received (including a different 2xx code, or a 301/302 redirect)
- 请求客户端身份验证
- 超时(超时阈值为10秒)
- 无法连接