APIM Content-Encoding GZIP level

Malvaro 145 Reputation points
2024-02-14T14:46:00.38+00:00

Hello,

I am configuring my APIM, adding the following entries in my policy

    <set-variable name="gzipresponse" value="@(context.Request.Headers.GetValueOrDefault("Accept-Encoding", "null").Contains("gzip"))" />

.....

    <outbound>
        <base />
        <choose>
            <when condition="@(context.Variables.GetValueOrDefault<bool>("gzipresponse"))">
                <set-header name="Content-Encoding" exists-action="override">
                    <value>gzip</value>
                </set-header>
            </when>
        </choose>

And I would like to ask two questions.

  • When is BR compression expected to be available?
  • How can I add the Gzip level to my policy? If my understanding is correct the default level is 3 and I'd like to increase it.

Thanks for your help,

Cheers,

Moisés.

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

1 answer

Sort by: Most helpful
  1. MuthuKumaranMurugaachari-MSFT 22,441 Reputation points Moderator
    2024-02-17T00:09:56.71+00:00

    Malvaro

    #1 As of now, there isn't a specific ETA to support BR compression in APIM policy. I see similar feedback https://feedback.azure.com/d365community/idea/901e3826-0225-ec11-b6e6-000d3a4f0858 expressed by other customers as well and passed on your feedback internally with our product team for review.

    #2 Currently, APIM utilizes CompressionLevel Optimal with GZipStream and it is not possible to change (or configure) compression level right now. I acknowledge this is a good feature to have and would like to understand more on the use case/scenario.

    I hope this helps and let me know if any questions.


    If you found the answer to your question helpful, please take a moment to mark it as Yes for others to benefit from your experience. Or simply add a comment tagging me and would be happy to answer your questions.

    1 person found this answer 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.