{ Community }
  • Academy
  • Docs
  • Developers
  • Resources
    • Community Articles
    • Apigee on GitHub
    • Code Samples
    • Videos & eBooks
    • Accelerator Methodology
  • Support
  • Ask a Question
  • Spaces
    • Product Announcements
    • General
    • Edge/API Management
    • Developer Portal (Drupal-based)
    • Developer Portal (Integrated)
    • API Design
    • APIM on Istio
    • Extensions
    • Business of APIs
    • Academy/Certification
    • Adapter for Envoy
    • Analytics
    • Events
    • Hybrid
    • Integration (AWS, PCF, Etc.)
    • Microgateway
    • Monetization
    • Private Cloud Deployment
    • 日本語コミュニティ
    • Insights
    • IoT Apigee Link
    • BaaS/Usergrid
    • BaaS Transition/Migration
    • Apigee-127
    • New Customers
    • Topics
    • Questions
    • Articles
    • Ideas
    • Leaderboard
    • Badges
  • Log in
  • Sign up

Get answers, ideas, and support from the Apigee Community

  • Home /
  • Edge/API Management /
avatar image
3
Question by ggajria · Mar 19, 2015 at 03:11 PM · 5.5k Views apigee edgeapi proxydecompression

Does Apigee support compression/de-compression with GZIP/deflate compression?

We have a requirement to support compression/de-compression on an Apigee bundle.

I found a link on Apigee specifically below help page:

http://apigee.com/docs/api-services/reference/endpoint-properties-reference

I had a couple of queries around this:

1) Does it actually compress/decompress when I send traffic to Target endpoint? Or does it support the headers related to compression/decompression only?

2) In the scenario, where I get gzip/deflate compressed data, is it possible for my proxy to uncompress this data before sending it to backend target?

3) In the same scenario as above, Can I send the compressed data as is to target endpoint

Any more details like how to validate and test this would be great.

Comment
Add comment
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Close

5 Answers

  • Sort: 
avatar image
4
Best Answer

Answer by Mike Dunker @Google   · Mar 19, 2015 at 04:52 PM

Hi,

Apigee Edge takes care of all compression automatically. As the document you linked to says, by default it will use the compression requested by the client, but you can change that using the target endpoint configuration.

The message is uncompressed when executing the request and response flows -- you never will see compressed data, and this all happens automatically.

You can test this using a test target like httpbin.org. The endpoint http://httpbin.org/gzip returns gzipped data, and you can see what kind of compression was sent to it.

Mike

Comment
Add comment Show 4 · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ggajria · Mar 23, 2015 at 12:48 PM 0
Link

Thanks @Mike Dunker. The HTTPBin link you posted seems to be "getting" data. Is there a way to do this when I am "posting" data? ie. Verify that the message I am posting to Apigee goes to the target in a compressed format.

Thanks,

Girish

avatar image Mike Dunker @Google ♦♦   · Mar 23, 2015 at 04:57 PM 1
Link

Hi Girish,

You can test this by using another proxy as a test target. Send a request via curl to a proxy and manually set the Content-Encoding header:

curl -X POST -H "Content-Encoding: gzip" "http://{myorg}-test.apigee.net/gziptest" -d '{ "test": "a" }'

Edge will expect gzip'd data. Since curl didn't gzip the data, you'll see the following error from Edge:

{"fault":{"faultstring":"Failed to Decompress","detail":{"errorcode":"messaging.adaptors.http.DecompressionFailure"}}}

Use the Edge proxy as the target. Trace the target proxy, and if you can see the Content-Encoding header set to gzip and can see the payload, then Edge was able to uncompress the data, and the data came in correctly gzip'd.

Note that you typically don't want to call back into an Apigee proxy from another Edge proxy in the same org. There are performance implications -- see the conversation about proxy chaining here: http://community.apigee.com/questions/1260/api-chaining.html . Just for testing is OK.

Mike

avatar image ggajria Mike Dunker @Google ♦♦ · Mar 24, 2015 at 02:29 PM 0
Link

Thanks @Mike Dunker. I was successfully able to test the compression and decompression with the "right" headers and "route rules".

Thanks,

Girish

avatar image Anoop Gupta · Oct 02, 2019 at 07:56 AM 0
Link

Hi @Mike Dunker ,

Apigee documentation says , for Transport Property, Compression.Algorithm supported values are gzip,deflate and none.

Does that mean Apigee dont support br i.e. compression using Brotli algorithm?

We have a requirement where we need to support all compression algorithms (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding), so checking if we need to explicitly do something to support br .

Thanks,

Anoop

avatar image
1

Answer by Alex Toombs · Nov 16, 2015 at 08:39 PM

What if a backend always responds with gzip, but the use-case is for Apigee to always respond with the decompressed response?

I have tried adding <Property name="compression.algorithm">none</Property> to the Proxy Endpoint as well as Target Endpoint to no avail.

In all cases, the response come back as gzipped.

Thanks.

Comment
Add comment Show 2 · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Louis.lim5 · Dec 03, 2015 at 11:31 PM 0
Link

Same here, my node app gzip it and looks like Apigee gzip again before it got returned to client. If I curl url | gunzip | gunzip I see what is expected.

avatar image Jon Young Louis.lim5 · Feb 10, 2016 at 05:29 AM 0
Link

I'm seeing the same thing @Louis.lim5 - someone in this thread: gzip problems implies it may be a known problem with a fix coming. Don't suppose you've found a solution already?

avatar image
0

Answer by gnanasekaran · Mar 22, 2016 at 04:04 PM

Hello

Louis-Etienne.Dorval

I think what might work for you in this case is,

> Do not enable/set compression in your nodejs code, so nodejs returns uncompressed response.

> In Edge Proxy - in the response flow - Add a header 'Content-Encoding: gzip' to your response using "AssignMessage" policy

Let me know if this workaround works for you

Thanks,

Mukundha

Comment
Add comment Show 1 · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Louis-Etienne Dorval · Mar 22, 2016 at 04:56 PM 0
Link

For the records, my question was basically: I'm using the NodeJS integration with Apigee Edge and the compression doesn't work.

Thanks @Mukundha Madhavan it's working perfectly now !

avatar image
0

Answer by Vasudeva · Jun 17, 2016 at 04:12 PM

if the response received from System SouthBound to APIGEE is uncompressed , can we configure APIGEE to compress the response before its sent to the client?

Comment
Add comment Show 2 · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Sartaj Singh Sisodiya   · Aug 16, 2018 at 11:26 AM 1
Link

yes , you can compress response .

You have to add header in response flow , attach below Assign Message in response flow -

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="AM-Set-Compress-Response">
    <DisplayName>AM-Set Compress Response</DisplayName>
    <Add>
        <Headers>
            <Header name="Content-Encoding">gzip</Header>
        </Headers>
    </Add>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>


avatar image Shapan Dashore · Apr 28, 2019 at 05:22 PM 0
Link

@Sartaj Singh Sisodiya, Do you know a way to decompress the response using assign message policy? Our backend always responds with a gzipped response.

avatar image
0

Answer by Kurt Googler Kanaskie · Apr 29, 2019 at 07:14 PM

In the case where a backend target returns compressed data and you want to un-compress it before sending to client, you can do so easily by using an Assign Message in the response flow.

For example using httpbin.org/gzip as the backend for testing.

curl -i https://ORG/proxy/gzip -H "Accept:application/json"

Add the following condition in the response flow:

<Response>
    <Step>
        <Condition>(request.header.accept = "application/json") and (response.header.content-encoding = "gzip")</Condition>
        <Name>AM-ZipResponseInflate</Name>
    </Step>
</Response>

Then the Assign Message policy is:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="AM-ZipResponseInflate">
    <DisplayName>AM-ZipResponseInflate</DisplayName>
    <Set>
        <Headers>
            <Header name="Content-Type">application/json</Header>
        </Headers>
        <Payload contentType="application/json">{response.content}</Payload>
        <StatusCode>200</StatusCode>
        <ReasonPhrase>Inflated Response</ReasonPhrase>
    </Set>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <AssignTo createNew="true" transport="http" type="response"/>
</AssignMessage>

NOTE: the use of createNew="true"

Comment
Add comment · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Follow this Question

Answers Answers and Comments

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Is it possible to run policies in parallel ? 1 Answer

unable to convert Xml To Json format using xslt 1 Answer

Generate random token number 3 Answers

Gateway returning 502 even if Target return 200 1 Answer

Accessing Apigee-hosted API Proxies from China 1 Answer

  • Products
    • Edge - APIs
    • Insights - Big Data
    • Plans
  • Developers
    • Overview
    • Documentation
  • Resources
    • Overview
    • Blog
    • Apigee Institute
    • Academy
    • Documentation
  • Company
    • Overview
    • Press
    • Customers
    • Partners
    • Team
    • Events
    • Careers
    • Contact Us
  • Support
    • Support Overview
    • Documentation
    • Status
    • Edge Support Portal
    • Privacy Policy
    • Terms & Conditions
© 2021 Apigee Corp. All rights reserved. - Apigee Community Terms of Use - Powered by AnswerHub
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Spaces
  • Product Announcements
  • General
  • Edge/API Management
  • Developer Portal (Drupal-based)
  • Developer Portal (Integrated)
  • API Design
  • APIM on Istio
  • Extensions
  • Business of APIs
  • Academy/Certification
  • Adapter for Envoy
  • Analytics
  • Events
  • Hybrid
  • Integration (AWS, PCF, Etc.)
  • Microgateway
  • Monetization
  • Private Cloud Deployment
  • 日本語コミュニティ
  • Insights
  • IoT Apigee Link
  • BaaS/Usergrid
  • BaaS Transition/Migration
  • Apigee-127
  • New Customers
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Badges