GZip on Azure Functions V3 Not Working

John Clark 96 Reputation points
2021-04-12T14:30:32.523+00:00

Hey everyone,

"I feel like I'm taking crazy pills", but I can't find the answer to my problem... I have a group of Azure Functions V3 that are serving up a REST API. They are on an "Always On" App service plan of B1.

In front of our Azure Functions, we are using Azure API Management. (Although this problem occurs when we make calls directly to the functions)

We have a larger API response that returns about 375k of JSON, and noticed that it wasn't being compressed (GZIP).

86997-image.png

Documents online seems to say it should just work by default, but mine isn't:

https://stackoverflow.com/questions/49339268/how-can-i-enable-gzip-compression-on-azure-functions-v2
https://github.com/Azure/azure-functions-host/issues/4000

I have been searching online for hours, and I have even searched for ways to disable gzip, so I could find the location of the settings so I could verify it wasn't disabled, but to no avail.

I even thought maybe it's compressed but somehow I'm missing it, so I tested it on webpagetest.org:

87022-image.png

Does anyone know why Azure Functions V3 wouldn't be returning gzip for me?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
{count} votes

Answer accepted by question author
  1. John Clark 96 Reputation points
    2021-04-19T22:15:53.127+00:00

    It appears that Azure Functions doesn't support middleware the same way that Web API does, so I cannot implement gzip response compressions in code like suggested in my comments under the issue https://github.com/Azure/azure-functions-host/issues/7285.

    At this point, I do not know any way to work around this issue and I am stuck with linux app services being unable to use gzip compression, so I have deployed a new function app on windows infrastructure.

    I wish there was an easier way, but at this point Microsoft sees gzip compression as a feature of Windows which is not available in Linux.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.