Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Referring to my blog on Azure API Management Troubleshooting Series, this is the fifth scenario of the lab. Please make sure you have followed the lab setup instructions as per this, to recreate the problem.
The ‘Resources’ API fetches user’s personal details, social media posts, comments and photos and utilizes the response returned for a machine learning project. Strangely after few days of using it ‘GetPosts’ operation started throwing HTTP 403 – Forbidden error whereas the other operations are working fine as expected.
{
"statusCode": 403,"message": "Forbidden"
}
Apart from the above, we are also encountering HTTP 429 - Too many requests error while invoking ‘GetComments’ operation for every 2nd request. The issue automatically gets resolve after 10 secs, however it reoccurs once the first call to API is made again. The behavior is not observed for the other operations.
{
"statusCode": 429,"message": "Rate limit is exceeded. Try again in 5 seconds."
}
<inbound>
<base />
<choose>
<when condition="@(context.Operation.Name.Equals("GetPosts"))">
<ip-filter action="forbid">
<address-range from="0.0.0.0" to="255.255.255.255" />
</ip-filter>
</when>
</choose>
</inbound>
<inbound>
<choose>
<when condition="@(context.Operation.Name.Equals("GetComments"))">
<rate-limit-by-key calls="1" renewal-period="10" increment-condition="@(context.Response.StatusCode == 200)" counter-key="@(context.Request.IpAddress)" />
</when>
</choose>
</inbound>
Read more about ip-filter and rate-limit-by-key policies in APIM.
Happy Learning !
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in