Search code examples
azureazure-web-app-serviceazure-traffic-manager

Azure traffic manager to use custom request header


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.


Solution

  • 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