Disable gzip responses in Azure Functions

D

By default, responses from Http Triggered Azure Functions are gzipped:

Not all clients are able to handle this (although they should be)
Turning it off isn’t particularly trivial.

A change needs to be made to applicationhost.config – which is located in LocalSiteRoot/Config
However, this file is readonly, so the change needs to be made via a xdt transform.

In the Azure portal, navigate to your Function App, and click on the Platform features tab.
Select Advanced tools (Kudu)

Select CMD under Debug console, to enter the Kudu shell:

Click the Planet icon, then Config:

This is where the applicationhost.config lives.

You can view it, or download it, but can’t edit it.
You’ll notice <urlCompression /> (around line 835) – which means urlCompression is currently enabled.

Back in the console, click the Home icon, then navigate to Site.

Create a file called applicationHost.xdt with the following content:

Stop and start the function app, which will apply this transform to applicationhost.config

Responses from your Azure Function app will now not be gzipped.