Is it possible to disable response buffering in APIM?

Mr Panucci 26 Reputation points
2020-10-15T20:48:59.51+00:00

I have a http triggered Azure Function with a canned response returning a collection of json objects. The response is flushed every 10 objects with a 2 second delay in between for 2 minutes.

When calling this endpoint directly to the Function I receive the flushed response immediately with no buffering - 10 complete objects with a 2 second delay for 2 minutes.

When I call this endpoint through Azure's APIM the response is no longer flushed immediately. I get partial objects and the response appears to be hitting a buffer which is only flushed after a certain time or size. Worse still, if I only flush a small amount of data APIM will hold onto it for the full 2 minutes until the origin connection is closed.

How can I force APIM to not buffer the response?

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
1,805 questions
{count} vote

Accepted answer
  1. Pramod Valavala 20,591 Reputation points Microsoft Employee
    2020-10-16T10:20:21.687+00:00

    Turns out that there is an attribute, buffer-response="false", on the forward-request policy that allows to disable buffering of the response that I can confirm does the trick. This is currently undocumented though. We will work towards getting the doc update for this.

    So, your forward-request policy becomes

    <backend>
       <forward-request buffer-response="false" />
    </backend>
    

0 additional answers

Sort by: Most helpful