Troubleshooting Azure Content Delivery Network file compression

Important

Azure CDN Standard from Microsoft (classic) will be retired on September 30, 2027. To avoid any service disruption, it is important that you migrate your Azure CDN Standard from Microsoft (classic) profiles to Azure Front Door Standard or Premium tier by September 30, 2027. For more information, see Azure CDN Standard from Microsoft (classic) retirement.

Azure CDN from Edgio will be retired on Januray 15, 2025. You must migrate your workload to Azure Front Door before this date to avoid service disruption. For more information, see Azure CDN from Edgio retirement FAQ.

This article helps you troubleshoot issues with CDN file compression.

If you need more help at any point in this article, you can contact the Azure experts on the MSDN Azure and the Stack Overflow forums. Alternatively, you can also file an Azure Support incident. Go to the Azure Support site and select Get Support.

Symptom

Compression for your endpoint is enabled, but files are being returned uncompressed.

Tip

To check whether your files are being returned compressed, you need to use a tool like Fiddler or your browser's developer tools. Check the HTTP response headers returned with your cached content delivery network content. If there is a header named Content-Encoding with a value of gzip, bzip2, brotli, or deflate, your content is compressed.

Content-Encoding header

Cause

There are several possible causes, including:

  • The requested content isn't eligible for compression.
  • Compression isn't enabled for the requested file type.
  • The HTTP request didn't include a header requesting a valid compression type.
  • Origin is sending chunked content.

Troubleshooting steps

Tip

As with deploying new endpoints, content delivery network configuration changes take some time to propagate through the network. Usually, changes are applied within 90 minutes. If this is the first time you've set up compression for your content delivery network endpoint, you should consider waiting 1-2 hours to be sure the compression settings have propagated to the POPs.

Verify the request

First, we should do a quick sanity check on the request. You can use your browser's developer tools to view the requests being made.

  • Verify the request is being sent to your endpoint URL, <endpointname>.azureedge.net, and not your origin.
  • Verify the request contains an Accept-Encoding header, and the value for that header contains gzip, deflate, brotli, or bzip2.

CDN request headers

Verify compression settings (standard CDN profiles)

Note

This step applies only if your CDN profile is an Azure CDN Standard from Microsoft or Azure CDN Standard from Edgio profile.

Navigate to your endpoint in the Azure portal and select the Configure button.

  • Verify compression is enabled.
  • Verify the MIME type for the content to be compressed is included in the list of compressed formats.

CDN compression settings

Verify compression settings (Premium CDN profiles)

Note

This step applies only if your CDN profile is an Azure CDN Premium from Edgio profile.

Navigate to your endpoint in the Azure portal and select the Manage button. The supplemental portal opens. Hover over the HTTP Large tab, then hover over the Cache Settings flyout. Select Compression.

  • Verify compression is enabled.
  • Verify the File Types list contains a comma-separated list (no spaces) of MIME types.
  • Verify the MIME type for the content to be compressed is included in the list of compressed formats.

CDN premium compression settings

Verify the content is cached (Edgio CDN profiles)

Note

This step applies only if your CDN profile is an Azure CDN Standard from Edgio or Azure CDN Premium from Edgio profile.

Using your browser's developer tools, check the response headers to ensure the file is cached in the region where it's being requested.

  • Check the Server response header. The header should have the format Platform (POP/Server ID), as seen in the following example.
  • Check the X-Cache response header. The header should read HIT.

CDN response headers

Verify the file meets the size requirements (Edgio CDN profiles)

Note

This step applies only if your CDN profile is an Azure CDN Standard from Edgio or Azure CDN Premium from Edgio profile.

To be eligible for compression, a file must meet the following size requirements:

  • Larger than 128 bytes (Content-Length: 128)
  • Smaller than 3 MB

Check the request at the origin server for a Via header

The Via HTTP header indicates to the web server that the request is being passed by a proxy server. Microsoft IIS web servers by default don't compress responses when the request contains a Via header. To override this behavior, perform the following: