Azure APIM 503 response during maintenance

Jaime Olivares 26 Reputation points
2021-09-16T20:28:33.203+00:00

We have a farm behind an Azure APIM service. Everything working OK.

Whenever we want to perform maintenance tasks, we want to flag APIM for returning 503 and preferably a dynamic countdown in the Retry-After header.

Is there a feature in APIM to do this?

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,129 questions
0 comments No comments
{count} votes

Accepted answer
  1. MayankBargali-MSFT 70,451 Reputation points
    2021-09-17T03:52:32.347+00:00

    @Jaime Olivares There is no out of box feature that can help you but you can implement the logic using APIM policy. You can use Set status code and set HTTP header policy to transform your backend respond according to your requirement.

    You can set some flag to only execute your maintenance policy only during your backend maintenance. You can save the flag status and maintenance duration/time using APIM named values so it is easy to update these value. In your policy you can get the maintenance time and compare with the current time using APIM policy expression @(DateTime.Now.ToString()) and set the Retry-After header value.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.