question

JohnClark-2534 avatar image
0 Votes"
JohnClark-2534 asked JohnClark-2534 edited

GZip on Azure Functions V3 Not Working

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
image.png (66.5 KiB)
image.png (82.3 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @JohnClark-2534 - Sorry for the delay in our responses here. I'm looking into this today and will update you with my findings.

1 Vote 1 ·

1 Answer

JohnClark-2534 avatar image
0 Votes"
JohnClark-2534 answered JohnClark-2534 edited

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.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Worth noting, windows based app service plans for the same performance are almost 4x more expensive.

  • B1 Windows: $54

  • B1 Linux: $14.

Yeah, not great :-/



0 Votes 0 ·