Is it possible to configure Azure Traffic Manager to poll an end point that requires an authorization header? The end point that we have developed for health check has authentication enabled which require credentials to be passed in the request header.
1 Answers
Currently Traffic Manager can't probe URIs behind authentication walls. That goes for Basic HTTP authentication as well.
i.e. If you're responding with a redirect,
HTTP/1.1 302 Found
Location: https://token.service
Traffic Manager will mark your endpoint Unhealthy since it expects a 200 OK
back.
You'll need a page/controller/route/whathaveyou that doesn't require authentication, and returns 200 OK
back to the Traffic Manager probe.
e.g. http://example.com/health
Put all your health logic in there - you could for example check if your database and Redis cache is healthy, and then return 200 OK
, else return 5xx
.
From https://azure.microsoft.com/en-gb/documentation/articles/traffic-manager-monitoring/:
Note:
Traffic Manager only considers an endpoint to be online if the return message is 200 OK. An endpoint is unhealthy when any of the following events occur:
- A non-200 response is received (including a different 2xx code, or a 301/302 redirect)
- Request for client authentication
- Timeout (the timeout threshold is 10 seconds)
- Unable to connect
-
Azure Traffic Manager configuration has recently added custom header and Expected Status Code configuration settings. It looks like these can be used to add http headers to the health probe requests. Custom headers can be set both on a global (per traffic manager profile) and on an endpoint level. – RasmusW Sep 12 '18 at 07:52
-
1This was GA'ed yesterday. Look for the "Azure Traffic Manager | Custom Header Support in Azure Traffic Manager GA" heading on https://blogs.technet.microsoft.com/stbnewsbytes/2018/09/24/cloud-platform-release-announcements-for-september-24-2018/. – RasmusW Sep 25 '18 at 06:48
-
1It is now also possible to configure which http response codes are considered healthy. (Look for "Azure Traffic Manager | Traffic Manager Custom Health Check Status Codes" in the above link). – RasmusW Sep 25 '18 at 06:49