Response from back-end always decompressed by Apigee

guycrets
Participant IV

Having a back-end server returning 2 MB gzipped response message. Unzipped > 10MB.

Apigee decompresses message and obviously gives error: {"fault":{"faultstring":"Body buffer overflow","detail":{"errorcode":"protocol.http.TooBigBody"}}}.

In earlier question and response (by Mike Duniker) I read: "The message is uncompressed when executing the request and response flows -- you never will see compressed data, and this all happens automatically

Is there an option to keep response message gzip-ped? And simply return that compressed copy to the client?

Apigee couldn't e.g. postpone the decompression until a policy accesses the response payload?

Solved Solved
1 2 728
1 ACCEPTED SOLUTION

guycrets
Participant IV

With the great help from Apigee support.

1) Enable streaming:

<HTTPTargetConnection>
  <Properties>
    <Property name="response.streaming.enabled">true</Property>
    <Property name="request.streaming.enabled">true</Property>
  </Properties><URL>https://...</URL>
</HTTPTargetConnection>

2) Enable gzip compression:

<PostFlow name="PostFlow">
  <Request/>
  <Response>
    <Step>
      <Name>AM-gzip</Name>
    </Step>
  </Response>
</PostFlow>
<AssignMessage async="false" continueOnError="false" enabled="true" name="AM-gzip">
  <DisplayName>AM-gzip</DisplayName>
  <Properties/>
  <Set>
    <Headers>
      <Header name="Content-Encoding">gzip</Header>
    </Headers>
  </Set>
  <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
  <AssignTo createNew="false" transport="https" type="response"/>
</AssignMessage>

View solution in original post

2 REPLIES 2

guycrets
Participant IV

With the great help from Apigee support.

1) Enable streaming:

<HTTPTargetConnection>
  <Properties>
    <Property name="response.streaming.enabled">true</Property>
    <Property name="request.streaming.enabled">true</Property>
  </Properties><URL>https://...</URL>
</HTTPTargetConnection>

2) Enable gzip compression:

<PostFlow name="PostFlow">
  <Request/>
  <Response>
    <Step>
      <Name>AM-gzip</Name>
    </Step>
  </Response>
</PostFlow>
<AssignMessage async="false" continueOnError="false" enabled="true" name="AM-gzip">
  <DisplayName>AM-gzip</DisplayName>
  <Properties/>
  <Set>
    <Headers>
      <Header name="Content-Encoding">gzip</Header>
    </Headers>
  </Set>
  <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
  <AssignTo createNew="false" transport="https" type="response"/>
</AssignMessage>

Even after doing what this solution suggests, Apigee still continues to decompress the response to the client. How can I get it to just send the compressed response and let the client handle decompression? Am I missing something with this solution?